Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(effects): steady padding drag, roundness kept through zero padding

EtienneLescot2a8a7571fcab
diff --git a/src/components/ai-edition/RightPanes.tsx b/src/components/ai-edition/RightPanes.tsx
index 58c668ec3..1d6489a23 100644
--- a/src/components/ai-edition/RightPanes.tsx
+++ b/src/components/ai-edition/RightPanes.tsx
@@ -2375,6 +2375,10 @@ export function VideoEffectsPane() {
// keeps showing its recording whole until the user says otherwise.
const fillDefault = settings.formatFollowCursor === null ? { formatFollowCursor: true } : {};
const [fitMenuOpen, setFitMenuOpen] = useState(false);
+ // Held from a padding drag's first move to its release. A drag through 0 would otherwise
+ // drop the Roundness row mid-gesture, and a pane scrolled to its end then clamps its
+ // scroll: the slider slides away under the pointer that is dragging it.
+ const [paddingScrubbing, setPaddingScrubbing] = useState(false);
const { locale } = useI18n();
const clipCountLabel = (count: number) => ts(pluralKey(locale, count), { count });
@@ -2633,16 +2637,20 @@ export function VideoEffectsPane() {
suffix="%"
disabled={!hasDocument}
onChange={(v) => {
- // No padding, no background to round against: roundness follows to 0.
- setLive(v === 0 ? { padding: 0, borderRadius: 0 } : { padding: v });
+ setPaddingScrubbing(true);
+ // Roundness is left as stored: at 0 the scene squares the corners, and the
+ // value is back when the padding is (`buildSceneDescription`).
+ setLive({ padding: v });
if (isNativeCompositorActive()) {
setNativeParam("padding", v / 100);
- if (v === 0) setNativeParam("roundness", 0);
}
}}
- onCommit={() => void commit()}
+ onCommit={() => {
+ setPaddingScrubbing(false);
+ void commit();
+ }}
/>
- {settings.padding > 0 ? (
+ {settings.padding > 0 || paddingScrubbing ? (
<>
{/* Under a frame the slider spans 0 → the most that frame wears well (the native
`frame_roundness_cap`), so its travel reads as a share of that range, not as
diff --git a/src/components/ai-edition/roundnessUnderFrame.test.tsx b/src/components/ai-edition/roundnessUnderFrame.test.tsx
index 32c413c34..b89feadce 100644
--- a/src/components/ai-edition/roundnessUnderFrame.test.tsx
+++ b/src/components/ai-edition/roundnessUnderFrame.test.tsx
@@ -65,3 +65,29 @@ describe("Roundness under a frame", () => {
await waitFor(() => expect(storedRadius()).toBe(64));
});
});
+
+describe("Roundness at zero padding", () => {
+ const padding = () => screen.getByRole("slider", { name: "Padding" });
+ const roundness = () => screen.queryByRole("slider", { name: "Roundness" });
+
+ it("keeps its row through a drag to 0 and leaves on release", () => {
+ // Dropped mid-drag, the row shrank a pane scrolled to its end, whose scroll then
+ // clamped and slid the padding slider away from the pointer dragging it.
+ mount({ padding: 30, borderRadius: 20 });
+ fireEvent.change(padding(), { target: { value: "0" } });
+ expect(roundness()).toBeInTheDocument();
+ fireEvent.mouseUp(padding());
+ expect(roundness()).not.toBeInTheDocument();
+ });
+
+ it("comes back with its value once the padding does", () => {
+ mount({ padding: 30, borderRadius: 20 });
+ fireEvent.change(padding(), { target: { value: "0" } });
+ fireEvent.mouseUp(padding());
+ expect(storedRadius()).toBe(20);
+
+ fireEvent.change(padding(), { target: { value: "10" } });
+ fireEvent.mouseUp(padding());
+ expect(roundness()).toHaveValue("20");
+ });
+});
diff --git a/src/native/sceneDescription.test.ts b/src/native/sceneDescription.test.ts
index a175d636b..ae2fe1526 100644
--- a/src/native/sceneDescription.test.ts
+++ b/src/native/sceneDescription.test.ts
@@ -1214,6 +1214,16 @@ describe("buildSceneDescription.settings mapping", () => {
expect(scene.effects.roundnessFrac).toBeCloseTo(12 / 1080, 10);
});
+ it("squares the corners at zero padding, from a roundness it does not erase", () => {
+ // No background to round against. The document keeps the value, so the corners come
+ // back as they were once the padding does.
+ const at = (padding: number) =>
+ buildSceneDescription(makeDoc({ legacyEditor: { padding, borderRadius: 12 } })).effects
+ .roundnessFrac;
+ expect(at(0)).toBe(0);
+ expect(at(1)).toBeCloseTo(12 / 1080, 10);
+ });
+
it("gives a 4K take the same roundness as a 1080p one", () => {
// The fraction used to be taken off the output's short side, which follows the
// source: a 2160p take got half the corner of a 1080p one. The native side scales
diff --git a/src/native/sceneDescription.ts b/src/native/sceneDescription.ts
index 3317949dd..fc61f607c 100644
--- a/src/native/sceneDescription.ts
+++ b/src/native/sceneDescription.ts
@@ -1193,8 +1193,9 @@ export function buildSceneDescription(
blur: settings.showBlur,
shadow: settings.shadowIntensity,
// The slider is in pixels of a 1080 reference, whatever the source resolution —
- // see `roundnessFrac`.
- roundnessFrac: settings.borderRadius / ROUNDNESS_REFERENCE_PX,
+ // see `roundnessFrac`. No padding, no background to round against: the corners go
+ // square, and the stored value waits for the padding to come back.
+ roundnessFrac: settings.padding > 0 ? settings.borderRadius / ROUNDNESS_REFERENCE_PX : 0,
motionBlur: settings.motionBlurAmount,
// Omitted at their defaults, like `webcamEffect`: the Rust side defaults both fields,
// so a project with no frame serializes exactly as it did before they existed.