feat: wireframe-to-code (#7334)

This commit is contained in:
David Luzar
2023-11-23 23:07:53 +01:00
committed by GitHub
parent d1e4421823
commit c7ee46e7f8
63 changed files with 2106 additions and 444 deletions
+9 -7
View File
@@ -1,3 +1,4 @@
import { TOOL_TYPE } from "./constants";
import {
Bounds,
getCommonBounds,
@@ -5,7 +6,7 @@ import {
getElementAbsoluteCoords,
} from "./element/bounds";
import { MaybeTransformHandleType } from "./element/transformHandles";
import { isBoundToContainer, isFrameElement } from "./element/typeChecks";
import { isBoundToContainer, isFrameLikeElement } from "./element/typeChecks";
import {
ExcalidrawElement,
NonDeletedExcalidrawElement,
@@ -262,7 +263,7 @@ const getReferenceElements = (
appState: AppState,
) => {
const selectedFrames = selectedElements
.filter((element) => isFrameElement(element))
.filter((element) => isFrameLikeElement(element))
.map((frame) => frame.id);
return getVisibleAndNonSelectedElements(
@@ -1352,10 +1353,11 @@ export const isActiveToolNonLinearSnappable = (
activeToolType: AppState["activeTool"]["type"],
) => {
return (
activeToolType === "rectangle" ||
activeToolType === "ellipse" ||
activeToolType === "diamond" ||
activeToolType === "frame" ||
activeToolType === "image"
activeToolType === TOOL_TYPE.rectangle ||
activeToolType === TOOL_TYPE.ellipse ||
activeToolType === TOOL_TYPE.diamond ||
activeToolType === TOOL_TYPE.frame ||
activeToolType === TOOL_TYPE.magicframe ||
activeToolType === TOOL_TYPE.image
);
};