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

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

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

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

