From fc3fc0082101bda5ef474755418905bf0b9297cd Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Mon, 8 Aug 2016 21:34:27 +0800 Subject: [PATCH] update keyboard shortcuts to Ctrl+E, Ctrl+R, and Ctrl+T, and update docs --- app/assets/javascripts/src/Metamaps.JIT.js | 6 ++-- .../javascripts/src/Metamaps.Listeners.js | 30 +++++++++---------- app/views/shared/_cheatsheet.html.erb | 7 +++-- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/app/assets/javascripts/src/Metamaps.JIT.js b/app/assets/javascripts/src/Metamaps.JIT.js index 2bdff385..543d4bfd 100644 --- a/app/assets/javascripts/src/Metamaps.JIT.js +++ b/app/assets/javascripts/src/Metamaps.JIT.js @@ -1316,7 +1316,7 @@ Metamaps.JIT = { if (Metamaps.Active.Map && Metamaps.Active.Mapper) menustring += '
  • Delete
    Ctrl+D
  • ' if (Metamaps.Active.Topic) { - menustring += '
  • Center this topic
    Ctrl+U
  • ' + menustring += '
  • Center this topic
    Ctrl+E
  • ' } menustring += '
  • Open in new tab
  • ' if (Metamaps.Active.Mapper) { @@ -1341,10 +1341,10 @@ Metamaps.JIT = { // set up the get sibling menu as a "lazy load" // only fill in the submenu when they hover over the get siblings list item var siblingMenu = '' - menustring += '
  • Get siblings' + siblingMenu + '
  • ' + menustring += '
  • Reveal siblings' + siblingMenu + '
  • ' } menustring += '' diff --git a/app/assets/javascripts/src/Metamaps.Listeners.js b/app/assets/javascripts/src/Metamaps.Listeners.js index 8ad44d2a..0520c0a5 100644 --- a/app/assets/javascripts/src/Metamaps.Listeners.js +++ b/app/assets/javascripts/src/Metamaps.Listeners.js @@ -44,11 +44,11 @@ Metamaps.Listeners = { } break case 69: // if e or E is pressed - if (e.ctrlKey) { - e.preventDefault() - if (Metamaps.Active.Map) { - Metamaps.JIT.zoomExtents(null, Metamaps.Visualize.mGraph.canvas) - } + if (e.ctrlKey && Metamaps.Active.Topic) { + self.centerAndReveal(Metamaps.Selected.Nodes, { + center: true, + reveal: false + }) } break case 72: // if h or H is pressed @@ -65,7 +65,15 @@ Metamaps.Listeners = { Metamaps.Control.removeSelectedEdges() } break - case 84: // if t or T is pressed + case 79: // if o or O is pressed + if (e.ctrlKey) { + e.preventDefault() + if (Metamaps.Active.Map) { + Metamaps.JIT.zoomExtents(null, Metamaps.Visualize.mGraph.canvas) + } + } + break + case 82: // if r or R is pressed if (e.ctrlKey && Metamaps.Active.Topic) { self.centerAndReveal(Metamaps.Selected.Nodes, { center: false, @@ -73,15 +81,7 @@ Metamaps.Listeners = { }) } break - case 85: // if u or U is pressed - if (e.ctrlKey && Metamaps.Active.Topic) { - self.centerAndReveal(Metamaps.Selected.Nodes, { - center: true, - reveal: false - }) - } - break - case 89: // if y or Y is pressed + case 84: // if t or T is pressed if (e.ctrlKey && Metamaps.Active.Topic) { self.centerAndReveal(Metamaps.Selected.Nodes, { center: true, diff --git a/app/views/shared/_cheatsheet.html.erb b/app/views/shared/_cheatsheet.html.erb index c02246ac..7541bd04 100644 --- a/app/views/shared/_cheatsheet.html.erb +++ b/app/views/shared/_cheatsheet.html.erb @@ -26,8 +26,9 @@
    -
    Recenter Topics around chosen Topic: Alt + click on the topic OR Right-click + 'center this topic'
    - +
    Recenter Topics around chosen Topic: Alt + click on the topic OR Ctrl + E
    +
    Reveal the siblings for a Topic: Right-click and choose 'Reveal siblings' OR Ctrl + R
    +
    Center topic and reveal siblings: Ctrl + T
    @@ -102,7 +103,7 @@
    Move around Canvas: Click and drag
    Zoom in/out: Scroll OR click on
    &
    -
    Zoom to see all: Click
    OR Ctrl + E
    +
    Zoom to see all: Click
    OR Ctrl + O