refactor: separate elements logic into a standalone package (#9285)
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user