Skip to content

The VS Code of video editing, built for agents.

TypeScript

Refactor scene rendering to utilize SolidPaint for fill colors

konstantin-paulusd09cc52fa370
diff --git a/apps/web/src/components/canvas/draw-overlay.tsx b/apps/web/src/components/canvas/draw-overlay.tsx
index bee794f1..b0ef9274 100644
--- a/apps/web/src/components/canvas/draw-overlay.tsx
+++ b/apps/web/src/components/canvas/draw-overlay.tsx
@@ -4,7 +4,7 @@
import { Show } from "solid-js";
import { useWorld } from "@diffusionstudio/koota-solid";
-import { Rect, Scene, Text } from "@diffusionstudio/reconciler";
+import { Rect, Scene, SolidPaint, Text } from "@diffusionstudio/reconciler";
import {
Computed,
findSceneAt,
@@ -215,12 +215,20 @@ export function DrawOverlay() {
const [entity] = editor.insertElement(parent, () => {
if (cfg.isScene) {
- return <Scene name={name} x={x} y={y} width={width} height={height} fill={cfg.fillColor} />;
+ return (
+ <Scene name={name} x={x} y={y} width={width} height={height}>
+ <SolidPaint color={cfg.fillColor} />
+ </Scene>
+ );
}
if (tool === ToolType.TEXT) {
return <Text name={name} x={x} y={y} {...size} fontSize={fontSize} color={cfg.fillColor}>Text</Text>;
}
- return <Rect name={name} x={x} y={y} {...size} fill={cfg.fillColor} />;
+ return (
+ <Rect name={name} x={x} y={y} {...size}>
+ <SolidPaint color={cfg.fillColor} />
+ </Rect>
+ );
});
if (entity) {
diff --git a/apps/web/src/engine/new-scene.tsx b/apps/web/src/engine/new-scene.tsx
index e5668dd2..8f64c5d9 100644
--- a/apps/web/src/engine/new-scene.tsx
+++ b/apps/web/src/engine/new-scene.tsx
@@ -8,7 +8,7 @@
// would otherwise do. The canvas and the timeline share this; they differ
// only in where the new scene should end up on screen.
-import { Scene as SceneElement } from '@diffusionstudio/reconciler';
+import { Scene as SceneElement, SolidPaint } from '@diffusionstudio/reconciler';
import { focusRect, getCameraMatrix, getNextName, Root, Source } from '@diffusionstudio/runtime';
import { getDocumentEditor } from './editor';
@@ -59,7 +59,9 @@ export function createScene(world: World, format: Size, options: NewSceneOptions
editor.reportEdit(root, 'camera', getCameraMatrix(world));
const [scene] = editor.insertElement(root, () => (
- <SceneElement name={name} x={rect.x} y={rect.y} width={rect.width} height={rect.height} fill="#000000" />
+ <SceneElement name={name} x={rect.x} y={rect.y} width={rect.width} height={rect.height}>
+ <SolidPaint color="#000000" />
+ </SceneElement>
));
if (!scene) return null;