mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Move group inside element
This commit is contained in:
parent
0027f08cad
commit
1c5b8372b9
16 changed files with 73 additions and 56 deletions
|
@ -5,11 +5,6 @@ import {
|
|||
elementsOverlappingBBox,
|
||||
} from "@excalidraw/utils";
|
||||
|
||||
import {
|
||||
getElementsInGroup,
|
||||
selectGroupsFromGivenElements,
|
||||
} from "@excalidraw/excalidraw/groups";
|
||||
|
||||
import {
|
||||
getElementsWithinSelection,
|
||||
getSelectedElements,
|
||||
|
@ -36,6 +31,8 @@ import type {
|
|||
|
||||
import type { ReadonlySetLike } from "@excalidraw/excalidraw/utility-types";
|
||||
|
||||
import { getElementsInGroup, selectGroupsFromGivenElements } from "./groups";
|
||||
|
||||
import { getElementLineSegments, getCommonBounds } from "./bounds";
|
||||
import { mutateElement } from "./mutateElement";
|
||||
import { getBoundTextElement, getContainerElement } from "./textElement";
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
import { getBoundTextElement } from "@excalidraw/element/textElement";
|
||||
|
||||
import { getSelectedElements } from "@excalidraw/excalidraw/scene";
|
||||
import { makeNextSelectedElementIds } from "@excalidraw/excalidraw/scene/selection";
|
||||
|
||||
import type {
|
||||
GroupId,
|
||||
ExcalidrawElement,
|
||||
|
@ -9,15 +12,12 @@ import type {
|
|||
ElementsMap,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { getSelectedElements } from "./scene";
|
||||
import { makeNextSelectedElementIds } from "./scene/selection";
|
||||
|
||||
import type {
|
||||
AppClassProperties,
|
||||
AppState,
|
||||
InteractiveCanvasAppState,
|
||||
} from "./types";
|
||||
import type { Mutable } from "./utility-types";
|
||||
} from "@excalidraw/excalidraw/types";
|
||||
import type { Mutable } from "@excalidraw/excalidraw/utility-types";
|
||||
|
||||
export const selectGroup = (
|
||||
groupId: GroupId,
|
|
@ -1,11 +1,17 @@
|
|||
import {
|
||||
convertToExcalidrawElements,
|
||||
Excalidraw,
|
||||
} from "@excalidraw/excalidraw";
|
||||
|
||||
import { API } from "@excalidraw/excalidraw/tests/helpers/api";
|
||||
import { Keyboard, Pointer } from "@excalidraw/excalidraw/tests/helpers/ui";
|
||||
import {
|
||||
getCloneByOrigId,
|
||||
render,
|
||||
} from "@excalidraw/excalidraw/tests/test-utils";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { API } from "./tests/helpers/api";
|
||||
import { Keyboard, Pointer } from "./tests/helpers/ui";
|
||||
import { getCloneByOrigId, render } from "./tests/test-utils";
|
||||
|
||||
import { convertToExcalidrawElements, Excalidraw } from "./index";
|
||||
|
||||
const { h } = window;
|
||||
const mouse = new Pointer("mouse");
|
||||
|
|
@ -15,9 +15,13 @@ import {
|
|||
} from "@excalidraw/element/typeChecks";
|
||||
import { getFrameChildren } from "@excalidraw/element/frame";
|
||||
|
||||
import {
|
||||
getElementsInGroup,
|
||||
selectGroupsForSelectedElements,
|
||||
} from "@excalidraw/element/groups";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { getElementsInGroup, selectGroupsForSelectedElements } from "../groups";
|
||||
import { t } from "../i18n";
|
||||
import { getSelectedElements, isSomeElementSelected } from "../scene";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
|
|
|
@ -33,16 +33,17 @@ import {
|
|||
getFrameChildren,
|
||||
} from "@excalidraw/element/frame";
|
||||
|
||||
import {
|
||||
selectGroupsForSelectedElements,
|
||||
getSelectedGroupForElement,
|
||||
getElementsInGroup,
|
||||
} from "@excalidraw/element/groups";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { ToolButton } from "../components/ToolButton";
|
||||
import { DuplicateIcon } from "../components/icons";
|
||||
|
||||
import {
|
||||
selectGroupsForSelectedElements,
|
||||
getSelectedGroupForElement,
|
||||
getElementsInGroup,
|
||||
} from "../groups";
|
||||
import { t } from "../i18n";
|
||||
import { isSomeElementSelected } from "../scene";
|
||||
import {
|
||||
|
|
|
@ -10,9 +10,10 @@ import { getFrameChildren } from "@excalidraw/element/frame";
|
|||
|
||||
import { KEYS, updateActiveTool } from "@excalidraw/common";
|
||||
|
||||
import { getElementsInGroup } from "@excalidraw/element/groups";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { getElementsInGroup } from "../groups";
|
||||
import { setCursorForShape } from "../cursor";
|
||||
import { frameToolIcon } from "../components/icons";
|
||||
import { getSelectedElements } from "../scene";
|
||||
|
|
|
@ -16,6 +16,16 @@ import {
|
|||
|
||||
import { KEYS, randomId, arrayToMap, getShortcutKey } from "@excalidraw/common";
|
||||
|
||||
import {
|
||||
getSelectedGroupIds,
|
||||
selectGroup,
|
||||
selectGroupsForSelectedElements,
|
||||
getElementsInGroup,
|
||||
addToGroup,
|
||||
removeFromSelectedGroups,
|
||||
isElementInGroup,
|
||||
} from "@excalidraw/element/groups";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawTextElement,
|
||||
|
@ -27,15 +37,6 @@ import { UngroupIcon, GroupIcon } from "../components/icons";
|
|||
|
||||
import { syncMovedIndices } from "../fractionalIndex";
|
||||
|
||||
import {
|
||||
getSelectedGroupIds,
|
||||
selectGroup,
|
||||
selectGroupsForSelectedElements,
|
||||
getElementsInGroup,
|
||||
addToGroup,
|
||||
removeFromSelectedGroups,
|
||||
isElementInGroup,
|
||||
} from "../groups";
|
||||
import { t } from "../i18n";
|
||||
|
||||
import { isSomeElementSelected } from "../scene";
|
||||
|
|
|
@ -4,9 +4,10 @@ import { isLinearElement } from "@excalidraw/element/typeChecks";
|
|||
|
||||
import { KEYS } from "@excalidraw/common";
|
||||
|
||||
import { selectGroupsForSelectedElements } from "@excalidraw/element/groups";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { selectGroupsForSelectedElements } from "../groups";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
|
||||
import { selectAllIcon } from "../components/icons";
|
||||
|
|
|
@ -2,11 +2,11 @@ import { updateBoundElements } from "@excalidraw/element/binding";
|
|||
import { getCommonBoundingBox } from "@excalidraw/element/bounds";
|
||||
import { mutateElement } from "@excalidraw/element/mutateElement";
|
||||
|
||||
import { getMaximumGroups } from "@excalidraw/element/groups";
|
||||
|
||||
import type { BoundingBox } from "@excalidraw/element/bounds";
|
||||
import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { getMaximumGroups } from "./groups";
|
||||
|
||||
import type Scene from "./scene/Scene";
|
||||
|
||||
export interface Alignment {
|
||||
|
|
|
@ -29,6 +29,8 @@ import {
|
|||
isTextElement,
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { getNonDeletedGroupIds } from "@excalidraw/element/groups";
|
||||
|
||||
import type { BindableProp, BindingProp } from "@excalidraw/element/binding";
|
||||
|
||||
import type { ElementUpdate } from "@excalidraw/element/mutateElement";
|
||||
|
@ -45,7 +47,6 @@ import type {
|
|||
} from "@excalidraw/element/types";
|
||||
|
||||
import { orderByFractionalIndex, syncMovedIndices } from "./fractionalIndex";
|
||||
import { getNonDeletedGroupIds } from "./groups";
|
||||
import { getObservedAppState } from "./store";
|
||||
|
||||
import type {
|
||||
|
|
|
@ -274,6 +274,16 @@ import { ShapeCache } from "@excalidraw/element/ShapeCache";
|
|||
|
||||
import { getRenderOpacity } from "@excalidraw/element/renderElement";
|
||||
|
||||
import {
|
||||
editGroupForSelectedElement,
|
||||
getElementsInGroup,
|
||||
getSelectedGroupIdForElement,
|
||||
getSelectedGroupIds,
|
||||
isElementInGroup,
|
||||
isSelectedViaGroup,
|
||||
selectGroupsForSelectedElements,
|
||||
} from "@excalidraw/element/groups";
|
||||
|
||||
import type { LocalPoint, Radians } from "@excalidraw/math";
|
||||
|
||||
import type {
|
||||
|
@ -362,15 +372,6 @@ import Library, { distributeLibraryItemsOnSquareGrid } from "../data/library";
|
|||
import { restore, restoreElements } from "../data/restore";
|
||||
|
||||
import { getCenter, getDistance } from "../gesture";
|
||||
import {
|
||||
editGroupForSelectedElement,
|
||||
getElementsInGroup,
|
||||
getSelectedGroupIdForElement,
|
||||
getSelectedGroupIds,
|
||||
isElementInGroup,
|
||||
isSelectedViaGroup,
|
||||
selectGroupsForSelectedElements,
|
||||
} from "../groups";
|
||||
import { History } from "../history";
|
||||
import { defaultLang, getLanguage, languages, setLanguage, t } from "../i18n";
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { getCommonBoundingBox } from "@excalidraw/element/bounds";
|
||||
import { newElementWith } from "@excalidraw/element/mutateElement";
|
||||
|
||||
import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
|
||||
import { getMaximumGroups } from "@excalidraw/element/groups";
|
||||
|
||||
import { getMaximumGroups } from "./groups";
|
||||
import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
export interface Distribution {
|
||||
space: "between";
|
||||
|
|
|
@ -42,6 +42,13 @@ import { getCornerRadius } from "@excalidraw/element/shapes";
|
|||
|
||||
import { renderSelectionElement } from "@excalidraw/element/renderElement";
|
||||
|
||||
import {
|
||||
isSelectedViaGroup,
|
||||
getSelectedGroupIds,
|
||||
getElementsInGroup,
|
||||
selectGroupsFromGivenElements,
|
||||
} from "@excalidraw/element/groups";
|
||||
|
||||
import type {
|
||||
SuggestedBinding,
|
||||
SuggestedPointBinding,
|
||||
|
@ -64,12 +71,6 @@ import type {
|
|||
NonDeleted,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import {
|
||||
isSelectedViaGroup,
|
||||
getSelectedGroupIds,
|
||||
getElementsInGroup,
|
||||
selectGroupsFromGivenElements,
|
||||
} from "../groups";
|
||||
import { renderSnaps } from "../renderer/renderSnaps";
|
||||
import { roundRect } from "../renderer/roundRect";
|
||||
import {
|
||||
|
|
|
@ -9,6 +9,8 @@ import {
|
|||
import { isNonDeletedElement } from "@excalidraw/element";
|
||||
import { isFrameLikeElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { getElementsInGroup } from "@excalidraw/element/groups";
|
||||
|
||||
import type { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
|
@ -22,7 +24,6 @@ import type {
|
|||
Ordered,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { getElementsInGroup } from "../groups";
|
||||
import {
|
||||
syncInvalidIndices,
|
||||
syncMovedIndices,
|
||||
|
|
|
@ -18,6 +18,8 @@ import {
|
|||
isFrameLikeElement,
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { getMaximumGroups } from "@excalidraw/element/groups";
|
||||
|
||||
import type { InclusiveRange } from "@excalidraw/math";
|
||||
|
||||
import type { Bounds } from "@excalidraw/element/bounds";
|
||||
|
@ -28,7 +30,6 @@ import type {
|
|||
NonDeletedExcalidrawElement,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { getMaximumGroups } from "./groups";
|
||||
import {
|
||||
getSelectedElements,
|
||||
getVisibleAndNonSelectedElements,
|
||||
|
|
|
@ -2,13 +2,14 @@ import { isFrameLikeElement } from "@excalidraw/element/typeChecks";
|
|||
|
||||
import { arrayToMap, findIndex, findLastIndex } from "@excalidraw/common";
|
||||
|
||||
import { getElementsInGroup } from "@excalidraw/element/groups";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawFrameLikeElement,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { syncMovedIndices } from "./fractionalIndex";
|
||||
import { getElementsInGroup } from "./groups";
|
||||
import { getSelectedElements } from "./scene";
|
||||
import Scene from "./scene/Scene";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue