mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix new element scene null leading to bugs after aligning
This commit is contained in:
parent
b7350f9707
commit
dce6010b29
5 changed files with 24 additions and 16 deletions
|
@ -245,6 +245,7 @@ import {
|
|||
isTransparent,
|
||||
easeToValuesRAF,
|
||||
muteFSAbortError,
|
||||
arrayToMap,
|
||||
} from "../utils";
|
||||
import {
|
||||
ContextMenu,
|
||||
|
@ -1094,6 +1095,12 @@ class App extends React.Component<AppProps, AppState> {
|
|||
},
|
||||
);
|
||||
}
|
||||
|
||||
// update frame membership if needed
|
||||
updateFrameMembershipOfSelectedElements(
|
||||
this.scene.getElementsIncludingDeleted(),
|
||||
this.state,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -3018,11 +3025,13 @@ class App extends React.Component<AppProps, AppState> {
|
|||
!(isTextElement(element) && element.containerId)),
|
||||
);
|
||||
|
||||
const elementsMap = arrayToMap(elements);
|
||||
|
||||
return getElementsAtPosition(elements, (element) =>
|
||||
hitTest(element, this.state, this.frameNameBoundsCache, x, y),
|
||||
).filter((element) => {
|
||||
// hitting a frame's element from outside the frame is not considered a hit
|
||||
const containingFrame = getContainingFrame(element);
|
||||
const containingFrame = getContainingFrame(element, elementsMap);
|
||||
return containingFrame && this.state.shouldRenderFrames
|
||||
? isCursorInFrame({ x, y }, containingFrame)
|
||||
: true;
|
||||
|
@ -5845,7 +5854,10 @@ class App extends React.Component<AppProps, AppState> {
|
|||
);
|
||||
|
||||
if (linearElement?.frameId) {
|
||||
const frame = getContainingFrame(linearElement);
|
||||
const frame = getContainingFrame(
|
||||
linearElement,
|
||||
arrayToMap(this.scene.getElementsIncludingDeleted()),
|
||||
);
|
||||
|
||||
if (frame && linearElement) {
|
||||
if (!elementOverlapsWithFrame(linearElement, frame)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue