more tweaks

This commit is contained in:
Lu[ke] Wilson 2023-11-20 15:45:08 +00:00
parent 40e9a4ec44
commit 6f6bcc4584
2 changed files with 14 additions and 8 deletions

View File

@ -28,13 +28,18 @@ export default function Home() {
type: "live-image",
x: 120,
y: 180,
isLocked: true,
});
};
return (
<main className="flex min-h-screen flex-col items-center justify-between">
<div className="fixed inset-0">
<Tldraw onMount={onEditorMount} shapeUtils={shapeUtils} />
<Tldraw
persistenceKey="tldraw-fal"
onMount={onEditorMount}
shapeUtils={shapeUtils}
/>
</div>
</main>
);

View File

@ -51,17 +51,18 @@ export function LiveImage() {
const onDrawingChange = useCallback(
debounce(async () => {
// 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) => {
if (shape.type === "live-image") {
return false;
}
const pageBounds = editor.getShapeMaskedPageBounds(shape);
if (!pageBounds) {
return false;
}
return bounds.includes(pageBounds);
return true;
// const pageBounds = editor.getShapeMaskedPageBounds(shape);
// if (!pageBounds) {
// return false;
// }
// return bounds.includes(pageBounds);
});
// Check if should submit request
@ -71,7 +72,7 @@ export function LiveImage() {
}
imageDigest.current = shapesDigest;
const svg = await editor.getSvg(shapes, { bounds, background: true });
const svg = await editor.getSvg(shapes, { background: true });
if (!svg) {
return;
}