Files
ueblueprint/js/input/mouse/Select.js
2023-02-08 22:15:37 +01:00

31 lines
734 B
JavaScript
Executable File

import IMouseClickDrag from "./IMouseClickDrag"
export default class Select extends IMouseClickDrag {
constructor(target, blueprint, options = {}) {
options.scrollGraphEdge ??= true
super(target, blueprint, options)
this.selectorElement = this.blueprint.template.selectorElement
}
startDrag() {
this.selectorElement.beginSelect(this.clickedPosition)
}
dragTo(location, movement) {
this.selectorElement.selectTo(location)
}
endDrag() {
if (this.started) {
this.selectorElement.endSelect()
}
}
unclicked() {
if (!this.started) {
this.blueprint.unselectAll()
}
}
}