more tweaks
This commit is contained in:
parent
40e9a4ec44
commit
6f6bcc4584
|
|
@ -28,13 +28,18 @@ export default function Home() {
|
||||||
type: "live-image",
|
type: "live-image",
|
||||||
x: 120,
|
x: 120,
|
||||||
y: 180,
|
y: 180,
|
||||||
|
isLocked: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="flex min-h-screen flex-col items-center justify-between">
|
<main className="flex min-h-screen flex-col items-center justify-between">
|
||||||
<div className="fixed inset-0">
|
<div className="fixed inset-0">
|
||||||
<Tldraw onMount={onEditorMount} shapeUtils={shapeUtils} />
|
<Tldraw
|
||||||
|
persistenceKey="tldraw-fal"
|
||||||
|
onMount={onEditorMount}
|
||||||
|
shapeUtils={shapeUtils}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -51,17 +51,18 @@ export function LiveImage() {
|
||||||
const onDrawingChange = useCallback(
|
const onDrawingChange = useCallback(
|
||||||
debounce(async () => {
|
debounce(async () => {
|
||||||
// TODO get actual drawing bounds
|
// TODO get actual drawing bounds
|
||||||
const bounds = new Box2d(120, 180, 512, 512);
|
// const bounds = new Box2d(120, 180, 512, 512);
|
||||||
|
|
||||||
const shapes = editor.getCurrentPageShapes().filter((shape) => {
|
const shapes = editor.getCurrentPageShapes().filter((shape) => {
|
||||||
if (shape.type === "live-image") {
|
if (shape.type === "live-image") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const pageBounds = editor.getShapeMaskedPageBounds(shape);
|
return true;
|
||||||
if (!pageBounds) {
|
// const pageBounds = editor.getShapeMaskedPageBounds(shape);
|
||||||
return false;
|
// if (!pageBounds) {
|
||||||
}
|
// return false;
|
||||||
return bounds.includes(pageBounds);
|
// }
|
||||||
|
// return bounds.includes(pageBounds);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Check if should submit request
|
// Check if should submit request
|
||||||
|
|
@ -71,7 +72,7 @@ export function LiveImage() {
|
||||||
}
|
}
|
||||||
imageDigest.current = shapesDigest;
|
imageDigest.current = shapesDigest;
|
||||||
|
|
||||||
const svg = await editor.getSvg(shapes, { bounds, background: true });
|
const svg = await editor.getSvg(shapes, { background: true });
|
||||||
if (!svg) {
|
if (!svg) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue