dont pan while using arrow keys during creation fixes #721 (#733)

This commit is contained in:
Connor Turland 2016-10-06 10:49:49 -04:00 committed by GitHub
parent 658f102a4e
commit 97d2868fad

View file

@ -16,6 +16,7 @@ const Listeners = {
$(document).on('keydown', function (e) { $(document).on('keydown', function (e) {
if (!(Active.Map || Active.Topic)) return if (!(Active.Map || Active.Topic)) return
const creatingTopic = e.target.id === 'topic_name'
switch (e.which) { switch (e.which) {
case 13: // if enter key is pressed case 13: // if enter key is pressed
// prevent topic creation if sending a message // prevent topic creation if sending a message
@ -28,16 +29,16 @@ const Listeners = {
JIT.escKeyHandler() JIT.escKeyHandler()
break break
case 37: // if Left arrow key is pressed case 37: // if Left arrow key is pressed
Visualize.mGraph.canvas.translate(-20, 0) if (!creatingTopic) Visualize.mGraph.canvas.translate(-20, 0)
break break
case 38: // if Up arrow key is pressed case 38: // if Up arrow key is pressed
Visualize.mGraph.canvas.translate(0, -20) if (!creatingTopic) Visualize.mGraph.canvas.translate(0, -20)
break break
case 39: // if Right arrow key is pressed case 39: // if Right arrow key is pressed
Visualize.mGraph.canvas.translate(20, 0) if (!creatingTopic) Visualize.mGraph.canvas.translate(20, 0)
break break
case 40: // if Down arrow key is pressed case 40: // if Down arrow key is pressed
Visualize.mGraph.canvas.translate(0, 20) if (!creatingTopic) Visualize.mGraph.canvas.translate(0, 20)
break break
case 65: // if a or A is pressed case 65: // if a or A is pressed
if (e.ctrlKey) { if (e.ctrlKey) {