Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Pix2Pix Tablet enabled
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description try to take over the world!
- // @author You
- // @match http://affinelayer.com/pixsrv/*
- // @grant none
- // ==/UserScript==
- console.log("Adding touch control event listeners");
- console.log(editors);
- for(var i in editors) {
- console.log("Adding touchmove to "+editors[i]);
- editors[i].view.ctx.canvas.addEventListener("touchmove", function(e) {
- mouse_pos = {x: e.targetTouches[0].clientX, y: e.targetTouches[0].clientY};
- mouse_down = true;
- mouse_pressed = false;
- e.preventDefault();
- update();
- });
- }
- document.addEventListener("touchstart", function(e) {
- mouse_pos = {x: e.targetTouches[0].clientX, y: e.targetTouches[0].clientY};
- mouse_down = false;
- mouse_pressed = false;
- update();
- });
- document.addEventListener("touchend", function(e) {
- mouse_pos = last_mouse_pos;
- mouse_down = false;
- mouse_released = true;
- update();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement