refactor: separate elements logic into a standalone package (#9285)

This commit is contained in:
Marcel Mraz
2025-03-26 15:24:59 +01:00
committed by GitHub
parent a18f059188
commit 432a46ef9e
372 changed files with 3463 additions and 2463 deletions
+13 -13
View File
@@ -1,20 +1,20 @@
import { KEYS, CODES, getShortcutKey, isDarwin } from "@excalidraw/common";
import {
moveOneLeft,
moveOneRight,
moveAllLeft,
moveAllRight,
} from "@excalidraw/element/zindex";
import {
BringForwardIcon,
BringToFrontIcon,
SendBackwardIcon,
SendToBackIcon,
} from "../components/icons";
import { isDarwin } from "../constants";
import { t } from "../i18n";
import { KEYS, CODES } from "../keys";
import { CaptureUpdateAction } from "../store";
import { getShortcutKey } from "../utils";
import {
moveOneLeft,
moveOneRight,
moveAllLeft,
moveAllRight,
} from "../zindex";
import { register } from "./register";
@@ -24,9 +24,9 @@ export const actionSendBackward = register({
keywords: ["move down", "zindex", "layer"],
icon: SendBackwardIcon,
trackEvent: { category: "element" },
perform: (elements, appState) => {
perform: (elements, appState, value, app) => {
return {
elements: moveOneLeft(elements, appState),
elements: moveOneLeft(elements, appState, app.scene),
appState,
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
};
@@ -54,9 +54,9 @@ export const actionBringForward = register({
keywords: ["move up", "zindex", "layer"],
icon: BringForwardIcon,
trackEvent: { category: "element" },
perform: (elements, appState) => {
perform: (elements, appState, value, app) => {
return {
elements: moveOneRight(elements, appState),
elements: moveOneRight(elements, appState, app.scene),
appState,
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
};