#77 hotkey plugin related changes

master
Agriya Dev5 2021-03-03 16:08:26 +05:30
parent 041c99a5c9
commit 9aeec1f53e
1 changed files with 22 additions and 11 deletions

View File

@ -285,21 +285,32 @@ class EditorStartup {
panning = false; panning = false;
}); });
$(document).bind('keydown', 'space', function (evt) { document.addEventListener('keydown', (e) => {
this.svgCanvas.spaceKey = keypan = true; if (e.target.nodeName !== 'BODY') return;
evt.preventDefault(); if(e.code.toLowerCase() === 'space'){
}.bind(this)).bind('keyup', 'space', function (evt) { this.svgCanvas.spaceKey = keypan = true;
evt.preventDefault(); e.preventDefault();
this.svgCanvas.spaceKey = keypan = false; } else if((e.key.toLowerCase() === 'shift') && (this.svgCanvas.getMode() === 'zoom')){
}.bind(this)).bind('keydown', 'shift', function (evt) {
if (this.svgCanvas.getMode() === 'zoom') {
this.workarea.css('cursor', zoomOutIcon); this.workarea.css('cursor', zoomOutIcon);
e.preventDefault();
} else {
return;
} }
}.bind(this)).bind('keyup', 'shift', function (evt) { });
if (this.svgCanvas.getMode() === 'zoom') {
document.addEventListener('keyup', (e) => {
if (e.target.nodeName !== 'BODY') return;
if(e.code.toLowerCase() === 'space'){
this.svgCanvas.spaceKey = keypan = false;
e.preventDefault();
} else if((e.key.toLowerCase() === 'shift') && (this.svgCanvas.getMode() === 'zoom')){
this.workarea.css('cursor', zoomInIcon); this.workarea.css('cursor', zoomInIcon);
e.preventDefault();
} else {
return;
} }
}.bind(this)); });
/** /**
* @function module:SVGthis.setPanning * @function module:SVGthis.setPanning