fix: regression in indexing when adding elements to frame (#6904)

This commit is contained in:
David Luzar
2023-08-18 16:34:01 +02:00
committed by GitHub
parent 9cd5e15917
commit de1ebad755
3 changed files with 141 additions and 10 deletions

View File

@ -17,6 +17,7 @@ import path from "path";
import { getMimeType } from "../../data/blob";
import {
newEmbeddableElement,
newFrameElement,
newFreeDrawElement,
newImageElement,
} from "../../element/newElement";
@ -24,6 +25,7 @@ import { Point } from "../../types";
import { getSelectedElements } from "../../scene/selection";
import { isLinearElementType } from "../../element/typeChecks";
import { Mutable } from "../../utility-types";
import { assertNever } from "../../utils";
const readFile = util.promisify(fs.readFile);
@ -244,6 +246,15 @@ export class API {
scale: rest.scale || [1, 1],
});
break;
case "frame":
element = newFrameElement({ ...base, width, height });
break;
default:
assertNever(
type,
`API.createElement: unimplemented element type ${type}}`,
);
break;
}
if (element.type === "arrow") {
element.startBinding = rest.startBinding ?? null;