mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:50:33 +08:00
24 lines
645 B
JavaScript
Executable File
24 lines
645 B
JavaScript
Executable File
import Pointing from "./Pointing"
|
|
|
|
export default class MouseTracking extends Pointing {
|
|
|
|
constructor(target, blueprint, options = {}) {
|
|
options.wantsFocusCallback = true
|
|
super(target, blueprint, options)
|
|
|
|
let self = this
|
|
this.mousemoveHandler = e => {
|
|
self.blueprint.entity.mousePosition = self.locationFromEvent(e)
|
|
return true
|
|
}
|
|
}
|
|
|
|
blueprintFocused() {
|
|
this.target.addEventListener("mousemove", this.mousemoveHandler)
|
|
}
|
|
|
|
blueprintUnfocused() {
|
|
this.target.removeEventListener("mousemove", this.mousemoveHandler)
|
|
}
|
|
}
|