From f5bab554ea6839871c8522ae1536d14ce738a4da Mon Sep 17 00:00:00 2001 From: Andrew Michael McNutt Date: Tue, 23 Jan 2024 16:24:34 -0800 Subject: [PATCH] bugs --- src/components/KeyboardHooks.svelte | 5 +++++ src/content-modules/contextual-tools/Rotate.svelte | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/KeyboardHooks.svelte b/src/components/KeyboardHooks.svelte index c4758dc7..652cc6ea 100644 --- a/src/components/KeyboardHooks.svelte +++ b/src/components/KeyboardHooks.svelte @@ -13,6 +13,7 @@ function onKeyDown(e: any) { const tagName = e.target.tagName.toLowerCase(); const tagType = e.target.type; + if (tagName === "input") { const isUIElement = tagType === "number" || tagType === "range" || tagType === "text"; @@ -20,6 +21,10 @@ return; } } + // block code mirror editing + if (e.target.getAttribute("class").includes("cm-content")) { + return; + } if (tagName === "textarea") { return; } diff --git a/src/content-modules/contextual-tools/Rotate.svelte b/src/content-modules/contextual-tools/Rotate.svelte index 10535b3c..60635c9d 100644 --- a/src/content-modules/contextual-tools/Rotate.svelte +++ b/src/content-modules/contextual-tools/Rotate.svelte @@ -27,6 +27,7 @@ let localColors = memorizedColors; let centerChannels = [0, 0, 0]; + if (rotationPoint === "avg") { const clrs = focusedColors.map((x) => localColors[x]); // @ts-ignore @@ -34,15 +35,16 @@ centerChannels = center.toChannels(); } else if (rotationPoint === "zero") { centerChannels = [0, 0, 0]; - } else { + } else if (localColors[rotationPoint]) { centerChannels = localColors[rotationPoint].toChannels(); + } else { + centerChannels = [0, 0, 0]; } const rotated = Object.fromEntries( focusedColors .map((x) => localColors[x]) .map((localColor) => { - console.log(localColor); const color = Color.toColorSpace(localColor, colorSpace); const channels = color.toChannels(); // https://math.stackexchange.com/questions/4354438/how-to-rotate-a-point-on-a-cartesian-plane-around-something-other-than-the-origi