mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-03-03 05:27:31 +08:00
Refactoring, various fixes
This commit is contained in:
@@ -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) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user