mask frame

This commit is contained in:
Lu[ke] Wilson 2023-11-24 12:19:10 +00:00
parent 0b65af00bd
commit 72ef944b8b
1 changed files with 9 additions and 0 deletions

View File

@ -17,6 +17,15 @@ const tools = [LiveImageTool];
export default function Home() { export default function Home() {
const onEditorMount = (editor: Editor) => { const onEditorMount = (editor: Editor) => {
// @ts-expect-error: patch
editor.isShapeOfType = function (arg, type) {
const shape = typeof arg === "string" ? this.getShape(arg)! : arg;
if (shape.type === "live-image" && type === "frame") {
return true;
}
return shape.type === type;
};
// If there isn't a live image shape, create one // If there isn't a live image shape, create one
const liveImage = editor.getCurrentPageShapes().find((shape) => { const liveImage = editor.getCurrentPageShapes().find((shape) => {
return shape.type === "live-image"; return shape.type === "live-image";