mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-23 15:24:45 +08:00
Large mouse events refactoring and cleanup
This commit is contained in:
18
js/input/UDragScroll.js
Normal file
18
js/input/UDragScroll.js
Normal 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
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user