Refactoring, various fixes

This commit is contained in:
barsdeveloper
2022-03-24 22:54:41 +01:00
parent 4dd2929a9f
commit 8a4e60c9ae
43 changed files with 937 additions and 589 deletions

View File

@@ -101,6 +101,7 @@ export default class IMouseClickDrag extends IPointing {
if (self.started) {
self.endDrag()
}
self.unclicked()
if (self.#trackingMouse) {
const dragEvent = self.getEvent(Configuration.trackingMouseEventName.end)
this.target.dispatchEvent(dragEvent)
@@ -146,4 +147,7 @@ export default class IMouseClickDrag extends IPointing {
endDrag() {
}
unclicked(location) {
}
}

View File

@@ -18,7 +18,11 @@ export default class Select extends IMouseClickDrag {
endDrag() {
if (this.started) {
this.selectorElement.finishSelecting()
} else {
}
}
unclicked() {
if (!this.started) {
this.blueprint.unselectAll()
}
}

View File

@@ -2,9 +2,27 @@ import IMouseWheel from "./IMouseWheel"
export default class Zoom extends IMouseWheel {
#enableZoonIn = false
get enableZoonIn() {
return this.#enableZoonIn
}
set enableZoonIn(value) {
value = Boolean(value)
if (value == this.#enableZoonIn) {
return
}
this.#enableZoonIn = value
}
wheel(variation, location) {
let zoomLevel = this.blueprint.getZoom()
zoomLevel -= variation
variation = -variation
if (!this.enableZoonIn && zoomLevel == 0 && variation > 0) {
return
}
zoomLevel += variation
this.blueprint.setZoom(zoomLevel, location)
}
}