Skip to content

The VS Code of video editing, built for agents.

TypeScript

Enhance Text Rendering and Inspector Logic

konstantin-paulusb195be7d0127
diff --git a/apps/web/src/components/canvas/draw-overlay.tsx b/apps/web/src/components/canvas/draw-overlay.tsx
index b0ef9274..dad2fedf 100644
--- a/apps/web/src/components/canvas/draw-overlay.tsx
+++ b/apps/web/src/components/canvas/draw-overlay.tsx
@@ -222,7 +222,12 @@ export function DrawOverlay() {
);
}
if (tool === ToolType.TEXT) {
- return <Text name={name} x={x} y={y} {...size} fontSize={fontSize} color={cfg.fillColor}>Text</Text>;
+ return (
+ <Text name={name} x={x} y={y} {...size} fontSize={fontSize}>
+ Text
+ <SolidPaint color={cfg.fillColor} />
+ </Text>
+ );
}
return (
<Rect name={name} x={x} y={y} {...size}>
diff --git a/apps/web/src/components/sidebar-right/inspector/inspector.tsx b/apps/web/src/components/sidebar-right/inspector/inspector.tsx
index 6b74470f..7b5efd75 100644
--- a/apps/web/src/components/sidebar-right/inspector/inspector.tsx
+++ b/apps/web/src/components/sidebar-right/inspector/inspector.tsx
@@ -157,7 +157,7 @@ export function Inspector() {
<FillsSettings selection={nodes()} />
</Show>
- <Show when={includesTarget("shape", "caption")}>
+ <Show when={includesTarget("shape", "text", "caption")}>
<SourceSettings selection={nodes()} />
</Show>
diff --git a/apps/web/src/components/sidebar-right/inspector/source.tsx b/apps/web/src/components/sidebar-right/inspector/source.tsx
index f8678631..ef7edeac 100644
--- a/apps/web/src/components/sidebar-right/inspector/source.tsx
+++ b/apps/web/src/components/sidebar-right/inspector/source.tsx
@@ -19,7 +19,7 @@ import { OpacitySwatch } from "@/components/ui/opacity-swatch";
import { ColorOpacityPicker } from "@/components/ui/color-opacity-picker";
import { assetName } from "@diffusionstudio/assets";
import { useHas, useTrait, useWorld } from "@diffusionstudio/koota-solid";
-import { AssetId, Color, Computed, PaintType, colorToHex, getIntrinsicPaint, parseColor } from "@diffusionstudio/runtime";
+import { AssetId, Color, Computed, PaintType, colorToHex, getIntrinsicPaint, isText, parseColor } from "@diffusionstudio/runtime";
import { useDerived, useEditor } from "@/engine/hooks";
import { syncKeyframe } from "@/engine/keyframes";
import { useLibrary } from "@/engine/library";
@@ -206,7 +206,8 @@ type SolidFillRowProps = {
};
/**
- * The node's intrinsic solid: the `fill` prop, edited in place as a hex the
+ * The node's intrinsic solid: the `fill` prop (`color` on a `<text>`, where
+ * it is the glyph color), edited in place as a hex the
* way a solid fill row edits its color, or through the picker the swatch
* opens — both are `fill` prop writes, the node keeps its identity. Read
* from `Computed.color` so it animates (the `color` keyframe track drives
@@ -219,16 +220,17 @@ function SolidFillRow(props: SolidFillRowProps) {
const color = useDerived(() => props.node.get(Computed)?.color ?? 0xE0E0E0);
const colorText = createMemo(() => colorToHex(color()).replace("#", ""));
+ const prop = () => (isText(props.node) ? "color" : "fill");
const updateColor = (next: number) => {
const hex = colorToHex(next);
- editor.editProperty(props.node, "fill", hex);
+ editor.editProperty(props.node, prop(), hex);
syncKeyframe(world, editor, props.node, "color", hex);
};
const handleRemoveFill = () => {
props.onPickingChange(false);
- editor.editProperty(props.node, "fill", false);
+ editor.editProperty(props.node, prop(), false);
};
const [draft, setDraft] = createSignal(colorText());
@@ -244,7 +246,7 @@ function SolidFillRow(props: SolidFillRowProps) {
setDraft(colorText());
return;
}
- editor.editProperty(props.node, "fill", colorToHex(next));
+ editor.editProperty(props.node, prop(), colorToHex(next));
};
const handleKeyDown = (event: KeyboardEvent & { currentTarget: HTMLInputElement }) => {