mirror of
https://github.com/sbrl/Nibriboard.git
synced 2018-01-10 21:33:49 +00:00
Implement pan & pointer tools
This commit is contained in:
parent
1f4afe1f78
commit
247d3f3cc6
2 changed files with 9 additions and 2 deletions
|
@ -355,7 +355,9 @@ class BoardWindow extends EventEmitter
|
||||||
handleCanvasMovement(event) {
|
handleCanvasMovement(event) {
|
||||||
// Don't bother processing it if it's a mouse / touch interaction and
|
// Don't bother processing it if it's a mouse / touch interaction and
|
||||||
// the control key isn't pressed
|
// the control key isn't pressed
|
||||||
if([ "mouse", "touch" ].includes(event.type) && !this.keyboard.DownKeys.includes(17))
|
if([ "mouse", "touch" ].includes(event.type) &&
|
||||||
|
!this.keyboard.DownKeys.includes(17) &&
|
||||||
|
this.interface.currentTool !== "pan")
|
||||||
return;
|
return;
|
||||||
// Store the viewport information for later
|
// Store the viewport information for later
|
||||||
this.viewportState = event;
|
this.viewportState = event;
|
||||||
|
|
|
@ -73,7 +73,9 @@ class Pencil
|
||||||
}
|
}
|
||||||
|
|
||||||
handleMouseMove(event) {
|
handleMouseMove(event) {
|
||||||
// todo add zoom support here
|
// Don't do anything at all if the brush tool isn't selected
|
||||||
|
if(this.boardWindow.interface.currentTool !== "brush")
|
||||||
|
return;
|
||||||
|
|
||||||
// Don't draw anything if the left mouse button isn't down
|
// Don't draw anything if the left mouse button isn't down
|
||||||
if(!this.mouse.leftDown)
|
if(!this.mouse.leftDown)
|
||||||
|
@ -99,6 +101,9 @@ class Pencil
|
||||||
}
|
}
|
||||||
|
|
||||||
handleMouseUp(event) {
|
handleMouseUp(event) {
|
||||||
|
// Don't do anything at all if the brush tool isn't selected
|
||||||
|
if(this.boardWindow.interface.currentTool !== "brush")
|
||||||
|
return;
|
||||||
// Ignore it if the ctrl key is held down - see above
|
// Ignore it if the ctrl key is held down - see above
|
||||||
if(this.boardWindow.keyboard.DownKeys.includes(17))
|
if(this.boardWindow.keyboard.DownKeys.includes(17))
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue