disable resize

This commit is contained in:
Lu[ke] Wilson 2023-11-20 15:33:40 +00:00
parent 0a43ca26ed
commit bc1726976e
2 changed files with 3 additions and 8 deletions

View File

@ -14,7 +14,7 @@ fal.config({
const shapeUtils = [LiveImageShapeUtil]; const shapeUtils = [LiveImageShapeUtil];
export default function Home() { export default function Home() {
const onEditorMount = useCallback((editor: Editor) => { const onEditorMount = (editor: Editor) => {
// 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";
@ -29,7 +29,7 @@ export default function Home() {
x: 120, x: 120,
y: 180, y: 180,
}); });
}, []); };
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">

View File

@ -156,12 +156,7 @@ type LiveImageShape = TLBaseShape<"live-image", { w: number; h: number }>;
export class LiveImageShapeUtil extends ShapeUtil<LiveImageShape> { export class LiveImageShapeUtil extends ShapeUtil<LiveImageShape> {
static override type = "live-image" as const; static override type = "live-image" as const;
override canReceiveNewChildrenOfType = ( override canResize = () => false;
shape: LiveImageShape,
type: TLShape["type"]
) => {
return true;
};
getDefaultProps(): LiveImageShape["props"] { getDefaultProps(): LiveImageShape["props"] {
return { return {