From f5d685fb214092c9c269745a30ec18b2507228ba Mon Sep 17 00:00:00 2001 From: JustJ01 Date: Wed, 18 Feb 2026 00:36:50 +0530 Subject: [PATCH] fixed alt-click clipping --- frontend/src/components/panels/Layers.svelte | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/panels/Layers.svelte b/frontend/src/components/panels/Layers.svelte index 8954721d7e..72b3b7bdfb 100644 --- a/frontend/src/components/panels/Layers.svelte +++ b/frontend/src/components/panels/Layers.svelte @@ -15,7 +15,7 @@ import type { NodeGraphState } from "@graphite/state-providers/node-graph"; import type { TooltipState } from "@graphite/state-providers/tooltip"; import { pasteFile } from "@graphite/utility-functions/files"; - import { operatingSystem } from "@graphite/utility-functions/platform"; + import { isDesktop, operatingSystem } from "@graphite/utility-functions/platform"; import LayoutCol from "@graphite/components/layout/LayoutCol.svelte"; import LayoutRow from "@graphite/components/layout/LayoutRow.svelte"; @@ -197,7 +197,7 @@ const [accel, oppositeAccel] = operatingSystem() === "Mac" ? [meta, ctrl] : [ctrl, meta]; // Alt-clicking to make a clipping mask - if (layerToClipAltKeyPressed && layerToClipUponClick && layerToClipUponClick.entry.clippable) clipLayer(layerToClipUponClick); + if (alt && layerToClipUponClick && layerToClipUponClick.entry.clippable) clipLayer(layerToClipUponClick); // Select the layer only if the accel and/or shift keys are pressed else if (!oppositeAccel && !alt) selectLayer(listing, accel, shift); @@ -209,7 +209,13 @@ } function clippingKeyPress(e: KeyboardEvent) { - layerToClipAltKeyPressed = e.altKey; + const isAltKeyEvent = e.key === "Alt" || e.key === "AltGraph"; + if (isAltKeyEvent) { + layerToClipAltKeyPressed = e.type === "keydown"; + return; + } + + layerToClipAltKeyPressed = e.getModifierState("Alt"); } function clippingHover(e: PointerEvent) { @@ -506,7 +512,7 @@ deselectAllLayers()}