summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-04-26 19:29:30 +0200
committerJules Laplace <julescarbon@gmail.com>2018-04-26 19:29:30 +0200
commitaaa6ce7d97f065b1a70719188d436be87d1674c7 (patch)
treeac121ed336832ae721033abf5692b608a492e578 /js
parent5f145fb65802844aa22563b67361b939f01d72fe (diff)
parent4b7d6d32ed9e440dc08257148a2c10162a6e90f8 (diff)
Merge branch 'master' of lmno:ascii
Diffstat (limited to 'js')
-rw-r--r--js/app.js5
-rw-r--r--js/draw.js14
-rw-r--r--js/ui/controls.js7
-rw-r--r--js/ui/keys.js27
4 files changed, 42 insertions, 11 deletions
diff --git a/js/app.js b/js/app.js
index 64f8bea..6afbbcc 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) {
@@ -69,6 +69,9 @@ function bind () {
}
})
window.addEventListener("touchend", function(){
+ if (current_tool.name === "text") {
+ if (is_desktop) cursor_input.focus()
+ }
dragging = false
})
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]
diff --git a/js/ui/controls.js b/js/ui/controls.js
index 315395d..f75ee67 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)
}
@@ -346,6 +346,7 @@ var controls = (function(){
].forEach(function(lex){
lex.span.addEventListener('mousedown', function(e){
lex.focus()
+ if (is_mobile) cursor_input.focus()
})
});
diff --git a/js/ui/keys.js b/js/ui/keys.js
index 77922c7..3cd6168 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
})()