mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-03-17 05:47:34 +08:00
Refactoring, various fixes
This commit is contained in:
@@ -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