mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Move align, distribute, zindex to element package
This commit is contained in:
parent
a3fef45365
commit
e7a0a7e0b7
8 changed files with 46 additions and 36 deletions
|
@ -7,7 +7,7 @@ import { getMaximumGroups } from "@excalidraw/element/groups";
|
||||||
import type { BoundingBox } from "@excalidraw/element/bounds";
|
import type { BoundingBox } from "@excalidraw/element/bounds";
|
||||||
import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
|
import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
|
||||||
|
|
||||||
import type Scene from "./scene/Scene";
|
import type Scene from "@excalidraw/excalidraw/scene/Scene";
|
||||||
|
|
||||||
export interface Alignment {
|
export interface Alignment {
|
||||||
position: "start" | "center" | "end";
|
position: "start" | "center" | "end";
|
|
@ -6,15 +6,16 @@ import { getElementsInGroup } from "@excalidraw/element/groups";
|
||||||
|
|
||||||
import { syncMovedIndices } from "@excalidraw/element/fractionalIndex";
|
import { syncMovedIndices } from "@excalidraw/element/fractionalIndex";
|
||||||
|
|
||||||
|
import { getSelectedElements } from "@excalidraw/excalidraw/scene";
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
ExcalidrawElement,
|
ExcalidrawElement,
|
||||||
ExcalidrawFrameLikeElement,
|
ExcalidrawFrameLikeElement,
|
||||||
} from "@excalidraw/element/types";
|
} from "@excalidraw/element/types";
|
||||||
|
|
||||||
import { getSelectedElements } from "./scene";
|
import type { AppState } from "@excalidraw/excalidraw/types";
|
||||||
import Scene from "./scene/Scene";
|
|
||||||
|
|
||||||
import type { AppState } from "./types";
|
import Scene from "../../excalidraw/scene/Scene";
|
||||||
|
|
||||||
const isOfTargetFrame = (element: ExcalidrawElement, frameId: string) => {
|
const isOfTargetFrame = (element: ExcalidrawElement, frameId: string) => {
|
||||||
return element.frameId === frameId || element.id === frameId;
|
return element.frameId === frameId || element.id === frameId;
|
|
@ -1,5 +1,3 @@
|
||||||
import React from "react";
|
|
||||||
|
|
||||||
import { KEYS } from "@excalidraw/common";
|
import { KEYS } from "@excalidraw/common";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -10,13 +8,17 @@ import {
|
||||||
actionAlignBottom,
|
actionAlignBottom,
|
||||||
actionAlignLeft,
|
actionAlignLeft,
|
||||||
actionAlignRight,
|
actionAlignRight,
|
||||||
} from "../actions";
|
} from "@excalidraw/excalidraw/actions";
|
||||||
import { defaultLang, setLanguage } from "../i18n";
|
import { defaultLang, setLanguage } from "@excalidraw/excalidraw/i18n";
|
||||||
import { Excalidraw } from "../index";
|
import { Excalidraw } from "@excalidraw/excalidraw";
|
||||||
|
|
||||||
import { API } from "./helpers/api";
|
import { API } from "@excalidraw/excalidraw/tests/helpers/api";
|
||||||
import { UI, Pointer, Keyboard } from "./helpers/ui";
|
import { UI, Pointer, Keyboard } from "@excalidraw/excalidraw/tests/helpers/ui";
|
||||||
import { act, unmountComponent, render } from "./test-utils";
|
import {
|
||||||
|
act,
|
||||||
|
unmountComponent,
|
||||||
|
render,
|
||||||
|
} from "@excalidraw/excalidraw/tests/test-utils";
|
||||||
|
|
||||||
const mouse = new Pointer("mouse");
|
const mouse = new Pointer("mouse");
|
||||||
|
|
|
@ -1,29 +1,32 @@
|
||||||
import React from "react";
|
|
||||||
|
|
||||||
import { selectGroupsForSelectedElements } from "@excalidraw/element/groups";
|
import { selectGroupsForSelectedElements } from "@excalidraw/element/groups";
|
||||||
|
|
||||||
import { reseed } from "@excalidraw/common";
|
import { reseed } from "@excalidraw/common";
|
||||||
|
|
||||||
import type {
|
|
||||||
ExcalidrawElement,
|
|
||||||
ExcalidrawFrameElement,
|
|
||||||
ExcalidrawSelectionElement,
|
|
||||||
} from "@excalidraw/element/types";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
actionSendBackward,
|
actionSendBackward,
|
||||||
actionBringForward,
|
actionBringForward,
|
||||||
actionBringToFront,
|
actionBringToFront,
|
||||||
actionSendToBack,
|
actionSendToBack,
|
||||||
actionDuplicateSelection,
|
actionDuplicateSelection,
|
||||||
} from "../actions";
|
} from "@excalidraw/excalidraw/actions";
|
||||||
|
|
||||||
import { Excalidraw } from "../index";
|
import { Excalidraw } from "@excalidraw/excalidraw";
|
||||||
|
|
||||||
import { API } from "./helpers/api";
|
import { API } from "@excalidraw/excalidraw/tests/helpers/api";
|
||||||
import { act, getCloneByOrigId, render, unmountComponent } from "./test-utils";
|
import {
|
||||||
|
act,
|
||||||
|
getCloneByOrigId,
|
||||||
|
render,
|
||||||
|
unmountComponent,
|
||||||
|
} from "@excalidraw/excalidraw/tests/test-utils";
|
||||||
|
|
||||||
import type { AppState } from "../types";
|
import type {
|
||||||
|
ExcalidrawElement,
|
||||||
|
ExcalidrawFrameElement,
|
||||||
|
ExcalidrawSelectionElement,
|
||||||
|
} from "@excalidraw/element/types";
|
||||||
|
|
||||||
|
import type { AppState } from "@excalidraw/excalidraw/types";
|
||||||
|
|
||||||
unmountComponent();
|
unmountComponent();
|
||||||
|
|
|
@ -6,9 +6,12 @@ import { updateFrameMembershipOfSelectedElements } from "@excalidraw/element/fra
|
||||||
|
|
||||||
import { KEYS, arrayToMap, getShortcutKey } from "@excalidraw/common";
|
import { KEYS, arrayToMap, getShortcutKey } from "@excalidraw/common";
|
||||||
|
|
||||||
|
import { alignElements } from "@excalidraw/element/align";
|
||||||
|
|
||||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||||
|
|
||||||
import { alignElements } from "../align";
|
import type { Alignment } from "@excalidraw/element/align";
|
||||||
|
|
||||||
import { ToolButton } from "../components/ToolButton";
|
import { ToolButton } from "../components/ToolButton";
|
||||||
import {
|
import {
|
||||||
AlignBottomIcon,
|
AlignBottomIcon,
|
||||||
|
@ -26,7 +29,6 @@ import { CaptureUpdateAction } from "../store";
|
||||||
|
|
||||||
import { register } from "./register";
|
import { register } from "./register";
|
||||||
|
|
||||||
import type { Alignment } from "../align";
|
|
||||||
import type { AppClassProperties, AppState, UIAppState } from "../types";
|
import type { AppClassProperties, AppState, UIAppState } from "../types";
|
||||||
|
|
||||||
export const alignActionsPredicate = (
|
export const alignActionsPredicate = (
|
||||||
|
|
|
@ -6,14 +6,17 @@ import { CODES, KEYS, arrayToMap, getShortcutKey } from "@excalidraw/common";
|
||||||
|
|
||||||
import { updateFrameMembershipOfSelectedElements } from "@excalidraw/element/frame";
|
import { updateFrameMembershipOfSelectedElements } from "@excalidraw/element/frame";
|
||||||
|
|
||||||
|
import { distributeElements } from "@excalidraw/element/distribute";
|
||||||
|
|
||||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||||
|
|
||||||
|
import type { Distribution } from "@excalidraw/element/distribute";
|
||||||
|
|
||||||
import { ToolButton } from "../components/ToolButton";
|
import { ToolButton } from "../components/ToolButton";
|
||||||
import {
|
import {
|
||||||
DistributeHorizontallyIcon,
|
DistributeHorizontallyIcon,
|
||||||
DistributeVerticallyIcon,
|
DistributeVerticallyIcon,
|
||||||
} from "../components/icons";
|
} from "../components/icons";
|
||||||
import { distributeElements } from "../distribute";
|
|
||||||
|
|
||||||
import { t } from "../i18n";
|
import { t } from "../i18n";
|
||||||
|
|
||||||
|
@ -22,8 +25,6 @@ import { CaptureUpdateAction } from "../store";
|
||||||
|
|
||||||
import { register } from "./register";
|
import { register } from "./register";
|
||||||
|
|
||||||
import type { Distribution } from "../distribute";
|
|
||||||
|
|
||||||
import type { AppClassProperties, AppState } from "../types";
|
import type { AppClassProperties, AppState } from "../types";
|
||||||
|
|
||||||
const enableActionGroup = (appState: AppState, app: AppClassProperties) => {
|
const enableActionGroup = (appState: AppState, app: AppClassProperties) => {
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
import { KEYS, CODES, getShortcutKey, isDarwin } from "@excalidraw/common";
|
import { KEYS, CODES, getShortcutKey, isDarwin } from "@excalidraw/common";
|
||||||
|
|
||||||
|
import {
|
||||||
|
moveOneLeft,
|
||||||
|
moveOneRight,
|
||||||
|
moveAllLeft,
|
||||||
|
moveAllRight,
|
||||||
|
} from "@excalidraw/element/zindex";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
BringForwardIcon,
|
BringForwardIcon,
|
||||||
BringToFrontIcon,
|
BringToFrontIcon,
|
||||||
|
@ -8,12 +15,6 @@ import {
|
||||||
} from "../components/icons";
|
} from "../components/icons";
|
||||||
import { t } from "../i18n";
|
import { t } from "../i18n";
|
||||||
import { CaptureUpdateAction } from "../store";
|
import { CaptureUpdateAction } from "../store";
|
||||||
import {
|
|
||||||
moveOneLeft,
|
|
||||||
moveOneRight,
|
|
||||||
moveAllLeft,
|
|
||||||
moveAllRight,
|
|
||||||
} from "../zindex";
|
|
||||||
|
|
||||||
import { register } from "./register";
|
import { register } from "./register";
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue