mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
perf: reduce unnecessary frame clippings (#8980)
* reduce unnecessary frame clippings * further optim
This commit is contained in:
parent
ec06fbc1fc
commit
dd1b45a25a
2 changed files with 152 additions and 46 deletions
|
@ -4,7 +4,7 @@ import { getElementAbsoluteCoords } from "../element";
|
|||
import {
|
||||
elementOverlapsWithFrame,
|
||||
getTargetFrame,
|
||||
isElementInFrame,
|
||||
shouldApplyFrameClip,
|
||||
} from "../frame";
|
||||
import {
|
||||
isEmbeddableElement,
|
||||
|
@ -273,6 +273,8 @@ const _renderStaticScene = ({
|
|||
}
|
||||
});
|
||||
|
||||
const inFrameGroupsMap = new Map<string, boolean>();
|
||||
|
||||
// Paint visible elements
|
||||
visibleElements
|
||||
.filter((el) => !isIframeLikeElement(el))
|
||||
|
@ -297,9 +299,16 @@ const _renderStaticScene = ({
|
|||
appState.frameRendering.clip
|
||||
) {
|
||||
const frame = getTargetFrame(element, elementsMap, appState);
|
||||
|
||||
// TODO do we need to check isElementInFrame here?
|
||||
if (frame && isElementInFrame(element, elementsMap, appState)) {
|
||||
if (
|
||||
frame &&
|
||||
shouldApplyFrameClip(
|
||||
element,
|
||||
frame,
|
||||
appState,
|
||||
elementsMap,
|
||||
inFrameGroupsMap,
|
||||
)
|
||||
) {
|
||||
frameClip(frame, context, renderConfig, appState);
|
||||
}
|
||||
renderElement(
|
||||
|
@ -400,7 +409,16 @@ const _renderStaticScene = ({
|
|||
|
||||
const frame = getTargetFrame(element, elementsMap, appState);
|
||||
|
||||
if (frame && isElementInFrame(element, elementsMap, appState)) {
|
||||
if (
|
||||
frame &&
|
||||
shouldApplyFrameClip(
|
||||
element,
|
||||
frame,
|
||||
appState,
|
||||
elementsMap,
|
||||
inFrameGroupsMap,
|
||||
)
|
||||
) {
|
||||
frameClip(frame, context, renderConfig, appState);
|
||||
}
|
||||
render();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue