From e2b806357abc5953a0a0c758c39ed6eeafe5e469 Mon Sep 17 00:00:00 2001 From: Joe B Date: Sun, 14 Oct 2018 23:16:18 -0500 Subject: [PATCH 1/7] Add zoom, zoom in, & zoom out shortcuts --- tags/actions/zoom-action.tag.html | 14 ++++++++++++++ tags/shortcuts.tag.html | 4 +++- tags/toolbox.tag.html | 10 ++++++++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/tags/actions/zoom-action.tag.html b/tags/actions/zoom-action.tag.html index 0f31caa..f418c28 100644 --- a/tags/actions/zoom-action.tag.html +++ b/tags/actions/zoom-action.tag.html @@ -70,6 +70,20 @@ this.on('mount', function () { //reset the input box's value according to image scale if(imgSelected) $("#zoom-scale").val(Math.round(imgSelected.size.imageScale*100)+'%'); + + document.addEventListener('keydown', e=>{ + if (e.key == '≠') {//Zoom in + $("img[data-zoom-type='in']").click(); + e.preventDefault(); + e.stopPropagation(); + } + + if (e.key == '–' && e.altKey) {//Zoom out + $("img[data-zoom-type='out']").click(); + e.preventDefault(); + e.stopPropagation(); + } + }); }); function rescaleImage(){ diff --git a/tags/shortcuts.tag.html b/tags/shortcuts.tag.html index af1aa17..9f45997 100644 --- a/tags/shortcuts.tag.html +++ b/tags/shortcuts.tag.html @@ -32,7 +32,9 @@ Alt + p Polygon Alt + w Magic wand Alt + m Move - Alt + + Zoom + Alt + z Zoom + Alt + + Zoom in + Alt + - Zoom out Alt + l Light `, diff --git a/tags/toolbox.tag.html b/tags/toolbox.tag.html index ac7e650..47f7ee5 100644 --- a/tags/toolbox.tag.html +++ b/tags/toolbox.tag.html @@ -66,18 +66,24 @@ e.stopPropagation() } */ - if (e.key == 'm' && e.altKey){//Magic wand + if (e.key == 'm' && e.altKey){//Move $("#tool-move").click(); e.preventDefault(); e.stopPropagation() } - if (e.key == 'l' && e.altKey){//Magic wand + if (e.key == 'l' && e.altKey){//Light $("#tool-light").click(); e.preventDefault(); e.stopPropagation() } + if (e.key == 'Ω'){//Zoom + $("#tool-zoom").click(); + e.preventDefault(); + e.stopPropagation() + } + }); }); From 147bb6bf6c531d77f6b3393b366bf45b96070bd3 Mon Sep 17 00:00:00 2001 From: Joe B Date: Sun, 21 Oct 2018 09:05:43 -0500 Subject: [PATCH 2/7] js/common-actions.js --- index.html | 1 + tags/actions/zoom-action.tag.html | 18 ++++-------------- tags/shortcuts.tag.html | 1 - 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/index.html b/index.html index d0cceef..7063d5b 100644 --- a/index.html +++ b/index.html @@ -166,6 +166,7 @@ + diff --git a/tags/actions/zoom-action.tag.html b/tags/actions/zoom-action.tag.html index f418c28..e80ccf0 100644 --- a/tags/actions/zoom-action.tag.html +++ b/tags/actions/zoom-action.tag.html @@ -33,6 +33,7 @@
+ + @@ -166,7 +167,7 @@ - + diff --git a/js/common-actions.js b/js/common-actions.js index a48ab5c..316b6b7 100644 --- a/js/common-actions.js +++ b/js/common-actions.js @@ -1,4 +1,5 @@ document.addEventListener('keydown', e=>{ + if (e.key == '≠') {//Zoom in $("#tool-zoom").click(); $("img[data-zoom-type='in']").click(); @@ -12,4 +13,5 @@ e.preventDefault(); e.stopPropagation(); } -}); \ No newline at end of file +}); + diff --git a/tags/toolbox.tag.html b/tags/toolbox.tag.html index 47f7ee5..741cfa9 100644 --- a/tags/toolbox.tag.html +++ b/tags/toolbox.tag.html @@ -84,6 +84,20 @@ e.stopPropagation() } + if (e.key == '≠') {//Zoom in + $("#tool-zoom").click(); + $("img[data-zoom-type='in']").click(); + e.preventDefault(); + e.stopPropagation(); + } + + if (e.key == '–' && e.altKey) {//Zoom out + $("#tool-zoom").click(); + $("img[data-zoom-type='out']").click(); + e.preventDefault(); + e.stopPropagation(); + } + }); }); From e02d02c742ba203b8dd7afa4e4560f7b02496f6e Mon Sep 17 00:00:00 2001 From: Joe B Date: Mon, 5 Nov 2018 23:08:09 -0600 Subject: [PATCH 5/7] changed click() to zoom() --- js/common-actions.js | 6 +++--- tags/toolbox.tag.html | 14 -------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/js/common-actions.js b/js/common-actions.js index 316b6b7..dd00d80 100644 --- a/js/common-actions.js +++ b/js/common-actions.js @@ -2,14 +2,14 @@ if (e.key == '≠') {//Zoom in $("#tool-zoom").click(); - $("img[data-zoom-type='in']").click(); + $("[data-zoom-type='in']").zoom(); e.preventDefault(); e.stopPropagation(); } - if (e.key == '–' && e.altKey) {//Zoom out + if (e.key == '–') {//Zoom out $("#tool-zoom").click(); - $("img[data-zoom-type='out']").click(); + $("[data-zoom-type='out']").zoom(); e.preventDefault(); e.stopPropagation(); } diff --git a/tags/toolbox.tag.html b/tags/toolbox.tag.html index 741cfa9..47f7ee5 100644 --- a/tags/toolbox.tag.html +++ b/tags/toolbox.tag.html @@ -84,20 +84,6 @@ e.stopPropagation() } - if (e.key == '≠') {//Zoom in - $("#tool-zoom").click(); - $("img[data-zoom-type='in']").click(); - e.preventDefault(); - e.stopPropagation(); - } - - if (e.key == '–' && e.altKey) {//Zoom out - $("#tool-zoom").click(); - $("img[data-zoom-type='out']").click(); - e.preventDefault(); - e.stopPropagation(); - } - }); }); From e595e8fd0f5f169caba8140f67eab269f9c18b55 Mon Sep 17 00:00:00 2001 From: Joe B Date: Mon, 5 Nov 2018 23:24:02 -0600 Subject: [PATCH 6/7] no longer calls twice --- index.html | 2 +- js/common-actions.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 8e831b4..134eb86 100644 --- a/index.html +++ b/index.html @@ -135,7 +135,7 @@ - + diff --git a/js/common-actions.js b/js/common-actions.js index dd00d80..84bf021 100644 --- a/js/common-actions.js +++ b/js/common-actions.js @@ -2,14 +2,15 @@ if (e.key == '≠') {//Zoom in $("#tool-zoom").click(); - $("[data-zoom-type='in']").zoom(); + $("[data-zoom-type='in']").click(); + console.log('test'); e.preventDefault(); e.stopPropagation(); } if (e.key == '–') {//Zoom out $("#tool-zoom").click(); - $("[data-zoom-type='out']").zoom(); + $("[data-zoom-type='out']").click(); e.preventDefault(); e.stopPropagation(); } From 1e2224f7b96a6378411365bb280c639e2651f3fc Mon Sep 17 00:00:00 2001 From: Joe B Date: Tue, 6 Nov 2018 18:46:38 -0600 Subject: [PATCH 7/7] removed console.log --- js/common-actions.js | 1 - 1 file changed, 1 deletion(-) diff --git a/js/common-actions.js b/js/common-actions.js index 84bf021..2349758 100644 --- a/js/common-actions.js +++ b/js/common-actions.js @@ -3,7 +3,6 @@ if (e.key == '≠') {//Zoom in $("#tool-zoom").click(); $("[data-zoom-type='in']").click(); - console.log('test'); e.preventDefault(); e.stopPropagation(); }