mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-20 05:24:52 +08:00
Resizeable comments
This commit is contained in:
51
js/input/mouse/MouseClickDrag.js
Executable file
51
js/input/mouse/MouseClickDrag.js
Executable file
@@ -0,0 +1,51 @@
|
||||
import MouseMoveDraggable from "./MouseMoveDraggable"
|
||||
|
||||
/** @typedef {import("../../Blueprint").default} Blueprint */
|
||||
|
||||
export default class MouseClickDrag extends MouseMoveDraggable {
|
||||
|
||||
#onClicked
|
||||
#onStartDrag
|
||||
#onDrag
|
||||
#onEndDrag
|
||||
|
||||
/**
|
||||
* @param {HTMLElement} target
|
||||
* @param {Blueprint} blueprint
|
||||
* @param {Object} options
|
||||
*/
|
||||
constructor(target, blueprint, options = {}) {
|
||||
super(target, blueprint, options)
|
||||
if (options.onClicked) {
|
||||
this.#onClicked = options.onClicked
|
||||
}
|
||||
if (options.onStartDrag) {
|
||||
this.#onStartDrag = options.onStartDrag
|
||||
}
|
||||
if (options.onDrag) {
|
||||
this.#onDrag = options.onDrag
|
||||
}
|
||||
if (options.onEndDrag) {
|
||||
this.#onEndDrag = options.onEndDrag
|
||||
}
|
||||
}
|
||||
|
||||
clicked() {
|
||||
super.clicked()
|
||||
this.#onClicked?.()
|
||||
}
|
||||
|
||||
startDrag() {
|
||||
super.startDrag()
|
||||
this.#onStartDrag?.()
|
||||
}
|
||||
|
||||
dragAction(location, movement) {
|
||||
this.#onDrag?.(location, movement)
|
||||
}
|
||||
|
||||
endDrag() {
|
||||
super.endDrag()
|
||||
this.#onEndDrag?.()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user