Large mouse events refactoring and cleanup

This commit is contained in:
barsdeveloper
2021-10-04 00:32:22 +02:00
parent dbff7a2c5f
commit fece3da438
17 changed files with 545 additions and 414 deletions

18
js/input/UDragScroll.js Normal file
View File

@@ -0,0 +1,18 @@
import UDrag from "./UDrag"
export default class UDragScroll extends UDrag {
dragTo(e) {
const mousePosition = this.snapToGrid(e.clientX, e.clientY)
// How far the mouse has been moved
const dx = mousePosition[0] - this.mousePosition[0]
const dy = mousePosition[1] - this.mousePosition[1]
this.blueprint.scrollDelta([-dx, -dy])
// Reassign the position of mouse
this.mousePosition = mousePosition
}
}