mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
bound text related fixes
This commit is contained in:
parent
7e737f233c
commit
1156086b77
2 changed files with 30 additions and 1 deletions
|
@ -315,6 +315,19 @@ export const getElementLineSegments = (
|
||||||
|
|
||||||
return [...rotatedSides, ...cornerSegments];
|
return [...rotatedSides, ...cornerSegments];
|
||||||
} else if (shape.type === "polygon") {
|
} else if (shape.type === "polygon") {
|
||||||
|
if (isTextElement(element)) {
|
||||||
|
const container = getContainerElement(element, elementsMap);
|
||||||
|
if (container && isLinearElement(container)) {
|
||||||
|
const segments: LineSegment<GlobalPoint>[] = [
|
||||||
|
lineSegment(pointFrom(x1, y1), pointFrom(x2, y1)),
|
||||||
|
lineSegment(pointFrom(x2, y1), pointFrom(x2, y2)),
|
||||||
|
lineSegment(pointFrom(x2, y2), pointFrom(x1, y2)),
|
||||||
|
lineSegment(pointFrom(x1, y2), pointFrom(x1, y1)),
|
||||||
|
];
|
||||||
|
return segments;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const points = shape.data as GlobalPoint[];
|
const points = shape.data as GlobalPoint[];
|
||||||
const segments: LineSegment<GlobalPoint>[] = [];
|
const segments: LineSegment<GlobalPoint>[] = [];
|
||||||
for (let i = 0; i < points.length - 1; i++) {
|
for (let i = 0; i < points.length - 1; i++) {
|
||||||
|
|
|
@ -4,7 +4,11 @@ import { type AnimationFrameHandler } from "../animation-frame-handler";
|
||||||
|
|
||||||
import { getElementLineSegments } from "../element/bounds";
|
import { getElementLineSegments } from "../element/bounds";
|
||||||
import { LinearElementEditor } from "../element/linearElementEditor";
|
import { LinearElementEditor } from "../element/linearElementEditor";
|
||||||
import { isFrameLikeElement, isLinearElement } from "../element/typeChecks";
|
import {
|
||||||
|
isFrameLikeElement,
|
||||||
|
isLinearElement,
|
||||||
|
isTextElement,
|
||||||
|
} from "../element/typeChecks";
|
||||||
|
|
||||||
import { getFrameChildren } from "../frame";
|
import { getFrameChildren } from "../frame";
|
||||||
import { selectGroupsForSelectedElements } from "../groups";
|
import { selectGroupsForSelectedElements } from "../groups";
|
||||||
|
@ -19,6 +23,7 @@ import type {
|
||||||
} from "../element/types";
|
} from "../element/types";
|
||||||
import type App from "../components/App";
|
import type App from "../components/App";
|
||||||
import type { LassoWorkerInput, LassoWorkerOutput } from "./types";
|
import type { LassoWorkerInput, LassoWorkerOutput } from "./types";
|
||||||
|
import { getContainerElement } from "../element/textElement";
|
||||||
|
|
||||||
export class LassoTrail extends AnimatedTrail {
|
export class LassoTrail extends AnimatedTrail {
|
||||||
private intersectedElements: Set<ExcalidrawElement["id"]> = new Set();
|
private intersectedElements: Set<ExcalidrawElement["id"]> = new Set();
|
||||||
|
@ -108,6 +113,17 @@ export class LassoTrail extends AnimatedTrail {
|
||||||
delete nextSelectedElementIds[child.id];
|
delete nextSelectedElementIds[child.id];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (element && isTextElement(element)) {
|
||||||
|
const container = getContainerElement(
|
||||||
|
element,
|
||||||
|
this.app.scene.getNonDeletedElementsMap(),
|
||||||
|
);
|
||||||
|
if (container) {
|
||||||
|
nextSelectedElementIds[container.id] = true;
|
||||||
|
delete nextSelectedElementIds[element.id];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const nextSelection = selectGroupsForSelectedElements(
|
const nextSelection = selectGroupsForSelectedElements(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue