Zoom in fixed

This commit is contained in:
barsdeveloper
2022-03-25 21:43:34 +01:00
parent 8a4e60c9ae
commit f6cd5bba05
6 changed files with 63 additions and 38 deletions

View File

@@ -30,16 +30,19 @@ export default class IKeyboardShortcut extends IContext {
this.#activationKeys = this.options.activationKeys ?? []
const wantsShift = keyEntry => keyEntry.bShift || keyEntry.Key == "LeftShift" || keyEntry.Key == "RightShift"
const wantsCtrl = keyEntry => keyEntry.bCtrl || keyEntry.Key == "LeftControl" || keyEntry.Key == "RightControl"
const wantsAlt = keyEntry => keyEntry.bAlt || keyEntry.Key == "LeftAlt" || keyEntry.Key == "RightAlt"
let self = this
/** @param {KeyboardEvent} e */
this.keyDownHandler = e => {
if (
self.#activationKeys.some(keyEntry =>
keyEntry.bShift === e.shiftKey
&& keyEntry.bCtrl === e.ctrlKey
&& keyEntry.bAlt === e.altKey
&& keyEntry.bCmd === e.metaKey
&& Configuration.Keys[keyEntry.Key] === e.code
wantsShift(keyEntry) == e.shiftKey
&& wantsCtrl(keyEntry) == e.ctrlKey
&& wantsAlt(keyEntry) == e.altKey
&& Configuration.Keys[keyEntry.Key] == e.code
)) {
e.preventDefault()
self.fire()
@@ -52,11 +55,11 @@ export default class IKeyboardShortcut extends IContext {
this.keyUpHandler = e => {
if (
self.#activationKeys.some(keyEntry =>
keyEntry.bShift && e.key === "Shift"
|| keyEntry.bCtrl && e.key === "Control"
|| keyEntry.bAlt && e.key === "Alt"
|| keyEntry.bCmd && e.key === "Meta" // Unsure about this, what key is that?
|| Configuration.Keys[keyEntry.Key] === e.code
keyEntry.bShift && e.key == "Shift"
|| keyEntry.bCtrl && e.key == "Control"
|| keyEntry.bAlt && e.key == "Alt"
|| keyEntry.bCmd && e.key == "Meta" // Unsure about this, what key is that?
|| Configuration.Keys[keyEntry.Key] == e.code
)) {
e.preventDefault()

View File

@@ -21,11 +21,11 @@ export default class KeyboardEnableZoom extends IKeyboardShortcut {
}
fire() {
this.zoomInputObject = this.blueprint.getInputObject(Zoom)
zoomInputObject.enableZoonIn = true
this.#zoomInputObject = this.blueprint.getInputObject(Zoom)
this.#zoomInputObject.enableZoonIn = true
}
unfire() {
this.#zoomInputObject.enableZoom = false
this.#zoomInputObject.enableZoonIn = false
}
}