From cbb7c093e5f5f64d5e8b29da84cf470d6eb95024 Mon Sep 17 00:00:00 2001 From: Jules Date: Fri, 6 Apr 2018 09:54:36 -0400 Subject: fix nopaint --- js/draw.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'js') diff --git a/js/draw.js b/js/draw.js index 407e1c8..9b0e3b9 100644 --- a/js/draw.js +++ b/js/draw.js @@ -111,18 +111,18 @@ var draw = (function(){ line(lex, [ xa[1][0], ya[1][0] ], [ xa[1][1], ya[1][1] ], erasing) } else { - var last_point_mod = [], point_mod = [] var x_a = mod( last_point[0], w ) var y_a = mod( last_point[1], h ) var x_b = mod( point[0], w ) var y_b = mod( point[1], h ) + var last_point_mod = [x_b, y_b], point_mod = [x_a, y_a] line(lex, last_point_mod, point_mod, erasing) - if (mirror_x) { - line(lex, [w-last_point_mod[0], last_point_mod[1]], [w-point_mod[0], point_mod[1]], erasing) - } - if (mirror_y) { - line(lex, [last_point_mod[0], h-last_point_mod[1]], [point_mod[0], h-point_mod[1]], erasing) - } + // if (mirror_x) { + // line(lex, [w-last_point_mod[0], last_point_mod[1]], [w-point_mod[0], point_mod[1]], erasing) + // } + // if (mirror_y) { + // line(lex, [last_point_mod[0], h-last_point_mod[1]], [point_mod[0], h-point_mod[1]], erasing) + // } } last_point[0] = point[0] last_point[1] = point[1] -- cgit v1.2.3-70-g09d2 From 5dda34dcc707afa0cab1bca9ba33572c019e7fc9 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 14 Apr 2018 20:05:57 +0200 Subject: trying to fix viewport woes --- index.html | 1 + js/ui/keys.js | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'js') diff --git a/index.html b/index.html index c822bb2..59bb2f1 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,7 @@ asciiblaster + diff --git a/js/ui/keys.js b/js/ui/keys.js index 77922c7..c157671 100644 --- a/js/ui/keys.js +++ b/js/ui/keys.js @@ -204,6 +204,33 @@ var keys = (function(){ } } + function cancelZoom() { + var d = document, + viewport, + content, + maxScale = ',maximum-scale=', + maxScaleRegex = /,*maximum\-scale\=\d*\.*\d*/; + + // this should be a focusable DOM Element + if (!this.addEventListener || !d.querySelector) { + return; + } + + viewport = d.querySelector('meta[name="viewport"]'); + content = viewport.content; + + function changeViewport(event) { + // http://nerd.vasilis.nl/prevent-ios-from-zooming-onfocus/ + viewport.content = content + (event.type == 'blur' ? (content.match(maxScaleRegex, '') ? '' : maxScale + 10) : maxScale + 1); + } + + // We could use DOMFocusIn here, but it's deprecated. + this.addEventListener('focus', changeViewport, true); + this.addEventListener('blur', changeViewport, false); + } + + cancelZoom.bind(cursor_input)(); + return keys })() -- cgit v1.2.3-70-g09d2 From 3f9baa7272327cd143e6e2cfe56a14e31634a701 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 15 Apr 2018 12:04:52 +0200 Subject: dont focus cursor_input on mobile --- js/app.js | 2 +- js/ui/controls.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'js') diff --git a/js/app.js b/js/app.js index 64f8bea..729f0d0 100644 --- a/js/app.js +++ b/js/app.js @@ -58,7 +58,7 @@ function bind () { var ae = document.activeElement if (ae !== shader_textarea && ae !== import_textarea && ae !== username_input && ae !== upload_input) { - cursor_input.focus() + if (is_desktop) cursor_input.focus() } if (selecting) { diff --git a/js/ui/controls.js b/js/ui/controls.js index 315395d..1ed7179 100644 --- a/js/ui/controls.js +++ b/js/ui/controls.js @@ -233,11 +233,11 @@ var controls = (function(){ controls.advanced.memorable = true controls.advanced.use = function(state){ console.log(state) - state = document.body.classList.contains('panke') + state = typeof state == "boolean" ? state : ! document.body.classList.contains('panke') if (state) - document.body.classList.remove('panke') - else document.body.classList.add('panke') + else + document.body.classList.remove('panke') this.update(state) } -- cgit v1.2.3-70-g09d2 From 2816501f853c09fda63c239ed37f3fc614ff3c7a Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 15 Apr 2018 12:15:47 +0200 Subject: fix scale --- index.html | 1 - js/ui/keys.js | 50 +++++++++++++++++++++++++------------------------- 2 files changed, 25 insertions(+), 26 deletions(-) (limited to 'js') diff --git a/index.html b/index.html index 59bb2f1..c822bb2 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,6 @@ asciiblaster - diff --git a/js/ui/keys.js b/js/ui/keys.js index c157671..3cd6168 100644 --- a/js/ui/keys.js +++ b/js/ui/keys.js @@ -204,32 +204,32 @@ var keys = (function(){ } } - function cancelZoom() { - var d = document, - viewport, - content, - maxScale = ',maximum-scale=', - maxScaleRegex = /,*maximum\-scale\=\d*\.*\d*/; - - // this should be a focusable DOM Element - if (!this.addEventListener || !d.querySelector) { - return; - } - - viewport = d.querySelector('meta[name="viewport"]'); - content = viewport.content; - - function changeViewport(event) { - // http://nerd.vasilis.nl/prevent-ios-from-zooming-onfocus/ - viewport.content = content + (event.type == 'blur' ? (content.match(maxScaleRegex, '') ? '' : maxScale + 10) : maxScale + 1); - } - - // We could use DOMFocusIn here, but it's deprecated. - this.addEventListener('focus', changeViewport, true); - this.addEventListener('blur', changeViewport, false); - } + // function cancelZoom() { + // var d = document, + // viewport, + // content, + // maxScale = ',maximum-scale=', + // maxScaleRegex = /,*maximum\-scale\=\d*\.*\d*/; + + // // this should be a focusable DOM Element + // if (!this.addEventListener || !d.querySelector) { + // return; + // } + + // viewport = d.querySelector('meta[name="viewport"]'); + // content = viewport.content; + + // function changeViewport(event) { + // // http://nerd.vasilis.nl/prevent-ios-from-zooming-onfocus/ + // viewport.content = content + (event.type == 'blur' ? (content.match(maxScaleRegex, '') ? '' : maxScale + 10) : maxScale + 1); + // } + + // // We could use DOMFocusIn here, but it's deprecated. + // this.addEventListener('focus', changeViewport, true); + // this.addEventListener('blur', changeViewport, false); + // } - cancelZoom.bind(cursor_input)(); + // cancelZoom.bind(cursor_input)(); return keys })() -- cgit v1.2.3-70-g09d2 From f1a446b5eb783bafc16ad5c6167b3876e7860dc6 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 15 Apr 2018 12:34:51 +0200 Subject: cursor input --- index.html | 1 + js/app.js | 3 +++ 2 files changed, 4 insertions(+) (limited to 'js') diff --git a/index.html b/index.html index c822bb2..8f42f4f 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,7 @@ asciiblaster + diff --git a/js/app.js b/js/app.js index 729f0d0..6afbbcc 100644 --- a/js/app.js +++ b/js/app.js @@ -69,6 +69,9 @@ function bind () { } }) window.addEventListener("touchend", function(){ + if (current_tool.name === "text") { + if (is_desktop) cursor_input.focus() + } dragging = false }) -- cgit v1.2.3-70-g09d2 From 4b7d6d32ed9e440dc08257148a2c10162a6e90f8 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 15 Apr 2018 12:36:41 +0200 Subject: focus --- js/ui/controls.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js') diff --git a/js/ui/controls.js b/js/ui/controls.js index 1ed7179..f75ee67 100644 --- a/js/ui/controls.js +++ b/js/ui/controls.js @@ -346,6 +346,7 @@ var controls = (function(){ ].forEach(function(lex){ lex.span.addEventListener('mousedown', function(e){ lex.focus() + if (is_mobile) cursor_input.focus() }) }); -- cgit v1.2.3-70-g09d2