Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Fix: auto-set padding when background is selected (#891)

Enejivk790711f55cd1
diff --git a/apps/desktop/src/routes/editor/ConfigSidebar.tsx b/apps/desktop/src/routes/editor/ConfigSidebar.tsx
index 13c7cbac0..3bc64d3fd 100644
--- a/apps/desktop/src/routes/editor/ConfigSidebar.tsx
+++ b/apps/desktop/src/routes/editor/ConfigSidebar.tsx
@@ -745,6 +745,12 @@ function BackgroundConfig(props: { scrollRef: HTMLDivElement }) {
}));
});
+ // set padding if background is selected
+ const ensurePaddingForBackground = () => {
+ if (project.background.padding === 0)
+ setProject("background", "padding", 10);
+ };
+
// Validate background source path on mount
onMount(async () => {
if (
@@ -887,6 +893,7 @@ function BackgroundConfig(props: { scrollRef: HTMLDivElement }) {
value={project.background.source.type}
onChange={(v) => {
const tab = v as BackgroundSource["type"];
+ ensurePaddingForBackground();
switch (tab) {
case "image": {
setProject("background", "source", {
@@ -1118,6 +1125,8 @@ function BackgroundConfig(props: { scrollRef: HTMLDivElement }) {
// Get the raw path without any URL prefixes
debouncedSetProject(wallpaper.rawPath);
+
+ ensurePaddingForBackground();
} catch (err) {
toast.error("Failed to set wallpaper");
}
diff --git a/apps/desktop/src/utils/createPresets.ts b/apps/desktop/src/utils/createPresets.ts
index 75942c04e..2217a7526 100644
--- a/apps/desktop/src/utils/createPresets.ts
+++ b/apps/desktop/src/utils/createPresets.ts
@@ -26,7 +26,7 @@ export function createPresets() {
query,
createPreset: async (preset: CreatePreset) => {
const config = { ...preset.config };
- // @ts-ignore we reeeally don't want the timeline in the preset
+ // @ts-expect-error we reeeally don't want the timeline in the preset
config.timeline = undefined;
await updatePresets((store) => {