JsDoc types fixed and typecheck activated

This commit is contained in:
barsdeveloper
2022-03-30 21:59:41 +02:00
parent 464a9c068d
commit 90400110e2
33 changed files with 391 additions and 151 deletions

View File

@@ -83,7 +83,7 @@ export default class IMouseClickDrag extends IPointing {
const movement = [e.movementX, e.movementY]
self.dragTo(location, movement)
if (self.#trackingMouse) {
self.blueprint.entity.mousePosition = self.locationFromEvent(e)
self.blueprint.mousePosition = self.locationFromEvent(e)
}
}

View File

@@ -22,6 +22,7 @@ export default class IMouseWheel extends IPointing {
let self = this
this.#mouseWheelHandler = e => {
e.preventDefault()
const location = self.locationFromEvent(e)
self.wheel(Math.sign(e.deltaY), location)
}

View File

@@ -24,11 +24,13 @@ export default class MouseTracking extends IPointing {
let self = this
this.#mousemoveHandler = e => {
self.blueprint.entity.mousePosition = self.locationFromEvent(e)
e.preventDefault()
self.blueprint.mousePosition = self.locationFromEvent(e)
}
this.#trackingMouseStolenHandler = e => {
if (!self.#mouseTracker) {
e.preventDefault()
this.#mouseTracker = e.detail.tracker
self.unlistenMouseMove()
}
@@ -36,6 +38,7 @@ export default class MouseTracking extends IPointing {
this.#trackingMouseGaveBackHandler = e => {
if (self.#mouseTracker == e.detail.tracker) {
e.preventDefault()
self.#mouseTracker = null
self.listenMouseMove()
}
@@ -52,13 +55,22 @@ export default class MouseTracking extends IPointing {
listenEvents() {
this.listenMouseMove()
this.blueprint.addEventListener(Configuration.trackingMouseEventName.begin, this.#trackingMouseStolenHandler)
this.blueprint.addEventListener(Configuration.trackingMouseEventName.end, this.#trackingMouseGaveBackHandler)
this.blueprint.addEventListener(
Configuration.trackingMouseEventName.begin,
/** @type {(e: Event) => any} */(this.#trackingMouseStolenHandler))
this.blueprint.addEventListener(
Configuration.trackingMouseEventName.end,
/** @type {(e: Event) => any} */(this.#trackingMouseGaveBackHandler))
}
unlistenEvents() {
this.unlistenMouseMove()
this.blueprint.removeEventListener(Configuration.trackingMouseEventName.begin, this.#trackingMouseStolenHandler)
this.blueprint.removeEventListener(Configuration.trackingMouseEventName.end, this.#trackingMouseGaveBackHandler)
this.blueprint.removeEventListener(
Configuration.trackingMouseEventName.begin,
/** @type {(e: Event) => any} */(this.#trackingMouseStolenHandler))
this.blueprint.removeEventListener(
Configuration.trackingMouseEventName.end,
/** @type {(e: Event) => any} */(this.#trackingMouseGaveBackHandler)
)
}
}