From 6ec259a0e71174651bae95d4628138bf6fd68742 Mon Sep 17 00:00:00 2001
From: kj_sh604
Date: Sun, 15 Mar 2026 16:19:35 -0400
Subject: refactor: packages/

---
 .../actions/actionToggleObjectsSnapMode.tsx        | 31 ++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 packages/excalidraw/actions/actionToggleObjectsSnapMode.tsx

(limited to 'packages/excalidraw/actions/actionToggleObjectsSnapMode.tsx')

diff --git a/packages/excalidraw/actions/actionToggleObjectsSnapMode.tsx b/packages/excalidraw/actions/actionToggleObjectsSnapMode.tsx
new file mode 100644
index 0000000..1ae3cbe
--- /dev/null
+++ b/packages/excalidraw/actions/actionToggleObjectsSnapMode.tsx
@@ -0,0 +1,31 @@
+import { magnetIcon } from "../components/icons";
+import { CODES, KEYS } from "../keys";
+import { CaptureUpdateAction } from "../store";
+import { register } from "./register";
+
+export const actionToggleObjectsSnapMode = register({
+  name: "objectsSnapMode",
+  label: "buttons.objectsSnapMode",
+  icon: magnetIcon,
+  viewMode: false,
+  trackEvent: {
+    category: "canvas",
+    predicate: (appState) => !appState.objectsSnapModeEnabled,
+  },
+  perform(elements, appState) {
+    return {
+      appState: {
+        ...appState,
+        objectsSnapModeEnabled: !this.checked!(appState),
+        gridModeEnabled: false,
+      },
+      captureUpdate: CaptureUpdateAction.EVENTUALLY,
+    };
+  },
+  checked: (appState) => appState.objectsSnapModeEnabled,
+  predicate: (elements, appState, appProps) => {
+    return typeof appProps.objectsSnapModeEnabled === "undefined";
+  },
+  keyTest: (event) =>
+    !event[KEYS.CTRL_OR_CMD] && event.altKey && event.code === CODES.S,
+});
-- 
cgit v1.2.3

