mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-16 02:10:38 +08:00
48 lines
1.2 KiB
JavaScript
Executable File
48 lines
1.2 KiB
JavaScript
Executable File
import ITemplate from "./ITemplate"
|
|
import MouseMoveDraggable from "../input/mouse/MouseMoveDraggable"
|
|
|
|
/**
|
|
* @typedef {import("../entity/IEntity").default} IEntity
|
|
* @typedef {import("../element/IDraggableElement").default} IDraggableElement
|
|
*/
|
|
|
|
/**
|
|
* @template {IDraggableElement} T
|
|
* @extends {ITemplate<T>}
|
|
*/
|
|
export default class IDraggableTemplate extends ITemplate {
|
|
|
|
getDraggableElement() {
|
|
return /** @type {Element} */(this.element)
|
|
}
|
|
|
|
createDraggableObject() {
|
|
return new MouseMoveDraggable(this.element, this.element.blueprint, {
|
|
draggableElement: this.getDraggableElement(),
|
|
})
|
|
}
|
|
|
|
createInputObjects() {
|
|
return [
|
|
...super.createInputObjects(),
|
|
this.createDraggableObject(),
|
|
]
|
|
}
|
|
|
|
topBoundary(justSelectableArea = false) {
|
|
return this.element.locationY
|
|
}
|
|
|
|
rightBoundary(justSelectableArea = false) {
|
|
return this.element.locationX + this.element.sizeX
|
|
}
|
|
|
|
bottomBoundary(justSelectableArea = false) {
|
|
return this.element.locationY + this.element.sizeY
|
|
}
|
|
|
|
leftBoundary(justSelectableArea = false) {
|
|
return this.element.locationX
|
|
}
|
|
}
|