diff --git a/assets/js/app.js b/assets/js/app.js index fdb60a6..fec3592 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -49,7 +49,7 @@ function bind () { var ae = document.activeElement if (ae !== import_textarea) { - if (is_desktop) cursor_input.focus() + cursor_input.focus() } if (selecting) { @@ -61,17 +61,17 @@ function bind () { }) window.addEventListener("touchend", function(){ if (current_tool.name === "text") { - if (is_desktop) cursor_input.focus() + cursor_input.focus() } dragging = false }) window.addEventListener('mousedown', function(e){ - // if (is_desktop) { cursor_input.focus() } + // cursor_input.focus() }) document.addEventListener('DOMContentLoaded', function(){ - if (is_desktop) { cursor_input.focus() } + cursor_input.focus() document.body.classList.remove('loading') }) diff --git a/assets/js/ui/canvas.js b/assets/js/ui/canvas.js index 57bea79..3d0e4a0 100644 --- a/assets/js/ui/canvas.js +++ b/assets/js/ui/canvas.js @@ -20,7 +20,6 @@ var canvas = current_canvas = (function(){ e.preventDefault() }) lex.span.addEventListener('mousedown', function(e){ - if (is_mobile) return e.preventDefault() dragging = true current_canvas = canvas @@ -57,7 +56,6 @@ var canvas = current_canvas = (function(){ lex.span.addEventListener("mousemove", function(e){ mouse.x = x mouse.y = y - if (is_mobile) return if (! dragging) return if (drawing) { draw.move(e, lex, point) @@ -72,45 +70,6 @@ var canvas = current_canvas = (function(){ }) }) - - if (is_mobile) { - canvas.rapper.addEventListener('touchstart', function(e){ - e.preventDefault() - var x, y, point, lex - x = (e.touches[0].pageX - canvas.rapper.offsetTop) / canvas.aa[0][0].span.offsetWidth - y = (e.touches[0].pageY - canvas.rapper.offsetTop) / canvas.aa[0][0].span.offsetHeight - x = ~~clamp(x, 0, canvas.aa[0].length-1) - y = ~~clamp(y, 0, canvas.aa.length-1) - point = [x,y] - lex = canvas.aa[y][x] - dragging = true - if (drawing) { - undo.new() - draw.down(e, lex, point) - } - else if (filling) { - undo.new() - draw.fill(brush, x, y) - } - canvas.focus(x, y) - }) - canvas.rapper.addEventListener("touchmove", function(e){ - e.preventDefault() - var x, y, point, lex - x = (e.touches[0].pageX - canvas.rapper.offsetTop) / canvas.aa[0][0].span.offsetWidth - y = (e.touches[0].pageY - canvas.rapper.offsetTop) / canvas.aa[0][0].span.offsetHeight - x = ~~clamp(x, 0, canvas.aa[0].length-1) - y = ~~clamp(y, 0, canvas.aa.length-1) - point = [x,y] - lex = canvas.aa[y][x] - if (! dragging) return - if (drawing) { - draw.move(e, lex, point) - } - canvas.focus(x, y) - }) - } - } canvas.min = 1 diff --git a/assets/js/ui/controls.js b/assets/js/ui/controls.js index efa3bae..0310df0 100644 --- a/assets/js/ui/controls.js +++ b/assets/js/ui/controls.js @@ -269,7 +269,6 @@ var controls = (function(){ ].forEach(function(lex){ lex.span.addEventListener('mousedown', function(e){ lex.focus() - if (is_mobile) cursor_input.focus() }) }); diff --git a/assets/js/ui/tool.js b/assets/js/ui/tool.js index ad62d80..15a83bd 100644 --- a/assets/js/ui/tool.js +++ b/assets/js/ui/tool.js @@ -26,7 +26,7 @@ var Tool = Model({ current_tool = this this.el.classList.add('focused') this.use() - if (is_desktop) { cursor_input.focus() } + cursor_input.focus() }, blur: function(){ current_tool = null @@ -45,7 +45,7 @@ var FileTool = Tool.extend({ current_filetool = this this.el.classList.add('focused') this.use() - if (is_desktop) { cursor_input.focus() } + cursor_input.focus() }, blur: function(){ current_filetool = null diff --git a/assets/js/util.js b/assets/js/util.js index ca97630..181068e 100644 --- a/assets/js/util.js +++ b/assets/js/util.js @@ -190,10 +190,3 @@ function setSelectionRange(input, selectionStart, selectionEnd) { function setCaretToPos(input, pos) { setSelectionRange(input, pos, pos); } - -// Naive useragent detection pattern -var is_iphone = (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) -var is_ipad = (navigator.userAgent.match(/iPad/i)) -var is_android = (navigator.userAgent.match(/Android/i)) -var is_mobile = is_iphone || is_ipad || is_android -var is_desktop = ! is_mobile; diff --git a/assets/text/TODO b/assets/text/TODO index e3fa8fb..269239d 100644 --- a/assets/text/TODO +++ b/assets/text/TODO @@ -7,4 +7,4 @@ 7) feature: status bar w/ position, etc. 8) feature: zoom {in,out} 9) reimplement: {save,upload} as PNG & gallery, shaders (possibly) -10) releases: merge w/ MiRCARTools (into asciiblaster,) provide signed release APK, set is_{iphone,ipad,android,mobile,desktop} +10) releases: merge w/ MiRCARTools (into asciiblaster,) provide signed release APK