JSDoc complete type check

This commit is contained in:
barsdeveloper
2022-10-09 11:43:28 +02:00
parent 91e1e0885e
commit cdc5e5b91b
68 changed files with 1603 additions and 648 deletions

View File

@@ -1,13 +1,11 @@
import IMouseClickDrag from "./IMouseClickDrag"
import MouseMoveDraggable from "./MouseMoveDraggable"
import Utility from "../../Utility"
/**
* @typedef {import("../../Blueprint").default} Blueprint
* @typedef {import("../../element/ISelectableDraggableElement").default} ISelectableDraggableElement
*/
/** @extends {IMouseClickDrag<ISelectableDraggableElement>} */
/** @extends {MouseMoveDraggable<ISelectableDraggableElement>} */
export default class MouseMoveNodes extends MouseMoveDraggable {
startDrag() {
@@ -17,24 +15,8 @@ export default class MouseMoveNodes extends MouseMoveDraggable {
}
}
dragTo(location, movement) {
const initialTargetLocation = [this.target.locationX, this.target.locationY]
const [mouseLocation, targetLocation] = this.stepSize > 1
? [Utility.snapToGrid(location, this.stepSize), Utility.snapToGrid(initialTargetLocation, this.stepSize)]
: [location, initialTargetLocation]
const d = [
mouseLocation[0] - this.mouseLocation[0],
mouseLocation[1] - this.mouseLocation[1]
]
if (d[0] == 0 && d[1] == 0) {
return
}
// Make sure it snaps on the grid
d[0] += targetLocation[0] - this.target.locationX
d[1] += targetLocation[1] - this.target.locationY
this.target.dispatchDragEvent(d)
// Reassign the position of mouse
this.mouseLocation = mouseLocation
dragAction(location, offset) {
this.target.dispatchDragEvent(offset)
}
unclicked() {