Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

feat(preview): a tray that spends its width on nothing it need not say

Jareerd84af734338f
diff --git a/engine/crates/concat/locales/de.json b/engine/crates/concat/locales/de.json
index b7c85278..2ef6ee55 100644
--- a/engine/crates/concat/locales/de.json
+++ b/engine/crates/concat/locales/de.json
@@ -185,7 +185,7 @@
"Filter": "Filter",
"filter": "Filter",
"Filters": "Filter",
- "Fit": "Einpassen",
+ "Fit the frame to the pane": "Bild in den Bereich einpassen",
"Finalising file": "Datei wird fertiggestellt",
"Finding the subject… {0}%": "Motiv wird gesucht… {0}%",
"Fisheye": "Fischauge",
diff --git a/engine/crates/concat/locales/en.json b/engine/crates/concat/locales/en.json
index 4ad9f370..21818099 100644
--- a/engine/crates/concat/locales/en.json
+++ b/engine/crates/concat/locales/en.json
@@ -239,7 +239,7 @@
"Finalising file": "Finalising file",
"Finding the subject… {0}%": "Finding the subject… {0}%",
"Fisheye": "Fisheye",
- "Fit": "Fit",
+ "Fit the frame to the pane": "Fit the frame to the pane",
"Flash": "Flash",
"Flash In": "Flash In",
"Flash Out": "Flash Out",
diff --git a/engine/crates/concat/locales/es.json b/engine/crates/concat/locales/es.json
index c72a5821..08c7fbe7 100644
--- a/engine/crates/concat/locales/es.json
+++ b/engine/crates/concat/locales/es.json
@@ -185,7 +185,7 @@
"Filter": "Filtro",
"filter": "filtro",
"Filters": "Filtros",
- "Fit": "Ajustar",
+ "Fit the frame to the pane": "Ajustar el cuadro al panel",
"Finalising file": "Finalizando el archivo",
"Finding the subject… {0}%": "Buscando el sujeto… {0}%",
"Fisheye": "Ojo de pez",
diff --git a/engine/crates/concat/locales/fr.json b/engine/crates/concat/locales/fr.json
index b24227a4..de981951 100644
--- a/engine/crates/concat/locales/fr.json
+++ b/engine/crates/concat/locales/fr.json
@@ -185,7 +185,7 @@
"Filter": "Filtre",
"filter": "filtre",
"Filters": "Filtres",
- "Fit": "Ajuster",
+ "Fit the frame to the pane": "Ajuster l'image au panneau",
"Finalising file": "Finalisation du fichier",
"Finding the subject… {0}%": "Recherche du sujet… {0}%",
"Fisheye": "Fisheye",
diff --git a/engine/crates/concat/locales/hr.json b/engine/crates/concat/locales/hr.json
index e1d7e8d7..4b7be231 100644
--- a/engine/crates/concat/locales/hr.json
+++ b/engine/crates/concat/locales/hr.json
@@ -234,7 +234,7 @@
"Filter": "Filtar",
"filter": "filtar",
"Filters": "Filtri",
- "Fit": "Prilagodi",
+ "Fit the frame to the pane": "Prilagodi kadar panelu",
"Finalising file": "Dovršavanje datoteke",
"Finding the subject… {0}%": "Traženje subjekta… {0}%",
"Fisheye": "Riblje oko",
diff --git a/engine/crates/concat/locales/it.json b/engine/crates/concat/locales/it.json
index 74106216..52f68e6e 100644
--- a/engine/crates/concat/locales/it.json
+++ b/engine/crates/concat/locales/it.json
@@ -185,7 +185,7 @@
"Filter": "Filtro",
"filter": "filtro",
"Filters": "Filtri",
- "Fit": "Adatta",
+ "Fit the frame to the pane": "Adatta il fotogramma al pannello",
"Finalising file": "Finalizzazione del file",
"Finding the subject… {0}%": "Ricerca del soggetto… {0}%",
"Fisheye": "Fisheye",
diff --git a/engine/crates/concat/locales/ja.json b/engine/crates/concat/locales/ja.json
index 07457b97..9ba4e343 100644
--- a/engine/crates/concat/locales/ja.json
+++ b/engine/crates/concat/locales/ja.json
@@ -185,7 +185,7 @@
"Filter": "フィルター",
"filter": "フィルター",
"Filters": "フィルター",
- "Fit": "フィット",
+ "Fit the frame to the pane": "フレームをパネルに合わせる",
"Finalising file": "ファイルを仕上げています",
"Finding the subject… {0}%": "被写体を検出中… {0}%",
"Fisheye": "魚眼",
diff --git a/engine/crates/concat/locales/ko.json b/engine/crates/concat/locales/ko.json
index ff11d199..f8d7b657 100644
--- a/engine/crates/concat/locales/ko.json
+++ b/engine/crates/concat/locales/ko.json
@@ -185,7 +185,7 @@
"Filter": "필터",
"filter": "필터",
"Filters": "필터",
- "Fit": "맞춤",
+ "Fit the frame to the pane": "프레임을 패널에 맞추기",
"Finalising file": "파일 마무리 중",
"Finding the subject… {0}%": "피사체 찾는 중… {0}%",
"Fisheye": "어안",
diff --git a/engine/crates/concat/locales/pt-BR.json b/engine/crates/concat/locales/pt-BR.json
index 8567b368..819bee41 100644
--- a/engine/crates/concat/locales/pt-BR.json
+++ b/engine/crates/concat/locales/pt-BR.json
@@ -185,7 +185,7 @@
"Filter": "Filtro",
"filter": "filtro",
"Filters": "Filtros",
- "Fit": "Ajustar",
+ "Fit the frame to the pane": "Ajustar o quadro ao painel",
"Finalising file": "Finalizando o arquivo",
"Finding the subject… {0}%": "Encontrando o sujeito… {0}%",
"Fisheye": "Olho de peixe",
diff --git a/engine/crates/concat/locales/ru.json b/engine/crates/concat/locales/ru.json
index ad810700..a6f43475 100644
--- a/engine/crates/concat/locales/ru.json
+++ b/engine/crates/concat/locales/ru.json
@@ -185,7 +185,7 @@
"Filter": "Фильтр",
"filter": "фильтр",
"Filters": "Фильтры",
- "Fit": "Вписать",
+ "Fit the frame to the pane": "Вписать кадр в панель",
"Finalising file": "Завершение файла",
"Finding the subject… {0}%": "Поиск объекта… {0}%",
"Fisheye": "Рыбий глаз",
diff --git a/engine/crates/concat/locales/tr.json b/engine/crates/concat/locales/tr.json
index e6320392..3232a0e5 100644
--- a/engine/crates/concat/locales/tr.json
+++ b/engine/crates/concat/locales/tr.json
@@ -185,7 +185,7 @@
"Filter": "Filtre",
"filter": "filtre",
"Filters": "Filtreler",
- "Fit": "Sığdır",
+ "Fit the frame to the pane": "Kareyi panele sığdır",
"Finalising file": "Dosya tamamlanıyor",
"Finding the subject… {0}%": "Özne bulunuyor… %{0}",
"Fisheye": "Balık gözü",
diff --git a/engine/crates/concat/locales/zh-Hans.json b/engine/crates/concat/locales/zh-Hans.json
index a3e84355..4042d5ef 100644
--- a/engine/crates/concat/locales/zh-Hans.json
+++ b/engine/crates/concat/locales/zh-Hans.json
@@ -185,7 +185,7 @@
"Filter": "滤镜",
"filter": "滤镜",
"Filters": "滤镜",
- "Fit": "适应",
+ "Fit the frame to the pane": "使画面适应面板",
"Finalising file": "正在完成文件",
"Finding the subject… {0}%": "正在识别主体… {0}%",
"Fisheye": "鱼眼",
diff --git a/engine/crates/concat/locales/zh-TW.json b/engine/crates/concat/locales/zh-TW.json
index efb0d54b..3a76914d 100644
--- a/engine/crates/concat/locales/zh-TW.json
+++ b/engine/crates/concat/locales/zh-TW.json
@@ -234,7 +234,7 @@
"Filter": "濾鏡",
"filter": "濾鏡",
"Filters": "濾鏡",
- "Fit": "適應",
+ "Fit the frame to the pane": "使畫面適應面板",
"Finalising file": "正在完成檔案",
"Finding the subject… {0}%": "正在辨識主體… {0}%",
"Fisheye": "魚眼",
diff --git a/engine/crates/concat/ui/primitives/select.slint b/engine/crates/concat/ui/primitives/select.slint
index 01bc93d3..b0b66551 100644
--- a/engine/crates/concat/ui/primitives/select.slint
+++ b/engine/crates/concat/ui/primitives/select.slint
@@ -32,6 +32,11 @@ export component Select inherits Rectangle {
in property <bool> enabled: true;
/// drop the field background, for a select used as panel chrome
in property <bool> flat;
+ /// Size `natural-width` to the current option rather than the widest.
+ /// For a control at the edge of a crowded tray, where the room a long
+ /// option would reserve is room the tray does not have; the trigger
+ /// then changes width as the choice does, which is the trade.
+ in property <bool> snug;
callback changed(index: int);
@@ -63,7 +68,8 @@ export component Select inherits Rectangle {
out property <length> natural-width: 8px + 6px + 12px + 6px
+ (root.marked
? root.mark-size
- : measure.preferred-width + (root.glyph != Glyph.none ? 12px + 6px : 0px));
+ : (root.snug ? shown.preferred-width : measure.preferred-width)
+ + (root.glyph != Glyph.none ? 12px + 6px : 0px));
height: Theme.h;
min-width: 60px;
@@ -172,6 +178,11 @@ export component Select inherits Rectangle {
text: option;
font-size: Theme.fs;
}
+ // The current option alone, for a `snug` trigger.
+ shown := Text {
+ text: root.label;
+ font-size: Theme.fs;
+ }
}
trigger := TouchArea {
diff --git a/engine/crates/concat/ui/workspace/preview-pane.slint b/engine/crates/concat/ui/workspace/preview-pane.slint
index 685d3a99..f95b934b 100644
--- a/engine/crates/concat/ui/workspace/preview-pane.slint
+++ b/engine/crates/concat/ui/workspace/preview-pane.slint
@@ -68,9 +68,10 @@ component RatioGlyph inherits Rectangle {
// against the trailing edge rather than joined on with a dash, so the column
// of ratios stays scannable and the sizes line up as a column of their own.
//
-// The trigger carries only the ratio and its glyph. The full size is what you
-// open the list to compare; repeating it on a closed control spends the width
-// of the whole tray on something already stated in the panel's header.
+// The trigger carries only the glyph. The ratio's name and its full size are
+// what you open the list to compare; either on a closed control spends the
+// width of the tray on something the shape already says, and the size is
+// stated in the panel's header besides.
component RatioPicker inherits Rectangle {
in property <[int]> widths;
in property <[int]> heights;
@@ -85,7 +86,7 @@ component RatioPicker inherits Rectangle {
property <int> active;
property <length> row-h: 26px;
- width: 92px;
+ width: 8px + 14px + 6px + 12px + 6px;
height: Theme.h;
border-radius: Theme.r;
background: (root.open || trigger.has-hover) ? Theme.field-hover : Theme.field;
@@ -110,20 +111,10 @@ component RatioPicker inherits Rectangle {
RatioGlyph {
ratio-w: root.widths[root.current];
ratio-h: root.heights[root.current];
- tint: Theme.fg-muted;
+ tint: Theme.fg;
}
}
- Text {
- horizontal-stretch: 1;
- text: root.names[root.current];
- color: Theme.fg;
- font-family: Theme.font-technical;
- font-size: Theme.fs;
- vertical-alignment: center;
- overflow: elide;
- }
-
VerticalLayout {
alignment: center;
Icon { glyph: Glyph.chevron-down; size: 12px; tint: Theme.fg-muted; }
@@ -1057,7 +1048,8 @@ export component PreviewPane inherits Rectangle {
VerticalLayout {
alignment: center;
Select {
- width: 104px;
+ snug: true;
+ width: self.natural-width;
current: root.quality-index;
options: [I18n.t("Full"), I18n.t("Half"), I18n.t("Quarter")];
details: ["1:1", "1:2", "1:4"];
@@ -1065,34 +1057,16 @@ export component PreviewPane inherits Rectangle {
}
}
- // How close we are looking. The steps are the view's,
- // and the trigger reads the live zoom between them, so
- // a wheel-zoomed view says "137%" rather than nothing.
+ // The one control the view needs: the way back. The
+ // zoom itself is the wheel's, and a readout of it was
+ // width spent on a number nobody steers by.
VerticalLayout {
alignment: center;
- Select {
- width: 76px;
- options: [I18n.t("Fit"), "25%", "50%", "100%", "200%", "400%"];
- current: viewport.fitted ? 0
- : viewport.zoom == 0.25 ? 1
- : viewport.zoom == 0.5 ? 2
- : viewport.zoom == 1 ? 3
- : viewport.zoom == 2 ? 4
- : viewport.zoom == 4 ? 5
- : -1;
- // Off `zoom`, not `scale`: the fitted scale is
- // a function of the pane's layout, and this
- // text is part of that layout - a loop the
- // compiler refuses. Fitted, the row says Fit.
- placeholder: "\{Math.round(viewport.zoom * 100)}%";
- changed(index) => {
- if (index == 0) {
- viewport.fit();
- } else {
- viewport.zoom-to(index == 1 ? 0.25 : index == 2 ? 0.5
- : index == 3 ? 1 : index == 4 ? 2 : 4);
- }
- }
+ IconButton {
+ glyph: Glyph.fit;
+ label: I18n.t("Fit the frame to the pane");
+ enabled: !viewport.fitted;
+ clicked => { viewport.fit(); }
}
}
}