mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-03 23:55:04 +08:00
18 lines
470 B
JavaScript
18 lines
470 B
JavaScript
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
|
|
}
|
|
|
|
} |