Skip to content

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

refactor(editor): hide zoom levels that would blur instead of explaining why

EtienneLescot2d6d19824383
diff --git a/src/components/ai-edition/v4/FloatingInspector.tsx b/src/components/ai-edition/v4/FloatingInspector.tsx
index 8f6f64b33..0189b5a2f 100644
--- a/src/components/ai-edition/v4/FloatingInspector.tsx
+++ b/src/components/ai-edition/v4/FloatingInspector.tsx
@@ -26,7 +26,7 @@ import {
ZoomIn,
} from "lucide-react";
import type { ComponentProps } from "react";
-import { useEffect, useId, useMemo, useRef, useState } from "react";
+import { useEffect, useMemo, useRef, useState } from "react";
import { toast } from "sonner";
import { parseCustomPlaybackSpeedInput } from "@/components/video-editor/customPlaybackSpeed";
import {
@@ -432,7 +432,7 @@ export function ZoomLevelControl({
region: { id: string; depth: ZoomDepth; customScale?: number };
tl: Pick<TimelineApi, "updateZoomDepth" | "updateZoomCustomScale">;
/** The deepest level this region's clip takes before its recording blurs
- * (`zoomScaleLimit`). Deeper presets are greyed out with the reason. */
+ * (`zoomScaleLimit`). Deeper presets are not offered. */
maxScale?: number;
}) {
const ts = useScopedT("settings");
@@ -511,12 +511,7 @@ export function ZoomLevelControl({
setScale(scale);
};
- const tooDeep = ts("zoom.levelBlurs", { max: maxScale });
- const tooDeepId = useId();
- const limited = maxScale < MAX_ZOOM_SCALE;
- const presets = ZOOM_PRESETS.map((preset) =>
- preset.value > maxScale ? { ...preset, disabled: true, title: tooDeep } : preset,
- );
+ const presets = ZOOM_PRESETS.filter((preset) => preset.value <= maxScale);
return (
<>
@@ -528,15 +523,8 @@ export function ZoomLevelControl({
options={presets}
value={requested}
onChange={setScale}
- describedBy={limited ? tooDeepId : undefined}
/>,
)}
- {/* Visible, not only a `title`: a disabled preset cannot take keyboard focus. */}
- {limited ? (
- <p id={tooDeepId} className={shell.hint}>
- {tooDeep}
- </p>
- ) : null}
{paneRow(
ts("zoom.customScale"),
<input
diff --git a/src/components/ai-edition/v4/ZoomLevelControl.test.tsx b/src/components/ai-edition/v4/ZoomLevelControl.test.tsx
index bbdf3a62c..ac85473af 100644
--- a/src/components/ai-edition/v4/ZoomLevelControl.test.tsx
+++ b/src/components/ai-edition/v4/ZoomLevelControl.test.tsx
@@ -123,7 +123,7 @@ describe("ZoomLevelControl", () => {
expect(updateZoomDepth).not.toHaveBeenCalled();
});
- it("greys out the levels that would blur this clip, with the reason, and refuses them typed", () => {
+ it("hides the levels that would blur this clip, and refuses them typed", () => {
const updateZoomDepth = vi.fn(async (_id: string, _depth: ZoomDepth) => true);
render(
<ZoomLevelControl
@@ -132,17 +132,7 @@ describe("ZoomLevelControl", () => {
maxScale={2.5}
/>,
);
- const buttons = screen.getAllByRole("button") as HTMLButtonElement[];
- expect(buttons.map((b) => b.disabled)).toEqual([false, false, false, true]);
- expect(buttons[3]).toHaveAttribute("title", "zoom.levelBlurs:2.5");
- // The reason is visible text the row points at, not only a title on a button that a
- // keyboard can never focus.
- const hint = screen.getByText("zoom.levelBlurs:2.5");
- expect(screen.getByRole("group", { name: "zoom.level" })).toHaveAttribute(
- "aria-describedby",
- hint.id,
- );
- expect(hint.id).not.toBe("");
+ expect(screen.getAllByRole("button")).toHaveLength(3);
const field = screen.getByRole("textbox", { name: "zoom.customScale" });
fireEvent.change(field, { target: { value: "3" } });
@@ -152,12 +142,9 @@ describe("ZoomLevelControl", () => {
expect(updateZoomDepth).not.toHaveBeenCalled();
});
- it("says nothing when every level is within reach", () => {
+ it("offers every level when all are within reach", () => {
renderControl(3);
- expect(screen.queryByText(/zoom\.levelBlurs/)).not.toBeInTheDocument();
- expect(screen.getByRole("group", { name: "zoom.level" })).not.toHaveAttribute(
- "aria-describedby",
- );
+ expect(screen.getAllByRole("button")).toHaveLength(4);
});
it("ignores an unparseable draft without touching the region", () => {
diff --git a/src/i18n/locales/ar/settings.json b/src/i18n/locales/ar/settings.json
index 524377004..218e536ef 100644
--- a/src/i18n/locales/ar/settings.json
+++ b/src/i18n/locales/ar/settings.json
@@ -381,7 +381,6 @@
"previewHold": "اضغط مع الاستمرار لمعاينة تأثير التكبير",
"customScale": "تكبير مخصص",
"customScaleRange": "يتراوح التكبير بين {{min}}× و{{max}}×",
- "levelBlurs": "بعد {{max}}×، سيُكبَّر هذا التسجيل أكثر من مرتين ويصبح ضبابيًا.",
"selectRegion": "حدد منطقة التكبير للتعديل",
"cursor": {
"title": "المؤشر",
diff --git a/src/i18n/locales/cs/settings.json b/src/i18n/locales/cs/settings.json
index 869d9b53b..3904fb2e0 100644
--- a/src/i18n/locales/cs/settings.json
+++ b/src/i18n/locales/cs/settings.json
@@ -381,7 +381,6 @@
"previewHold": "Podržte pro náhled efektu přiblížení",
"customScale": "Vlastní přiblížení",
"customScaleRange": "Přiblížení může být od {{min}}× do {{max}}×",
- "levelBlurs": "Nad {{max}}× by se tento záznam zvětšil víc než 2× a rozmazal se.",
"selectRegion": "Vyberte oblast přiblížení pro úpravu",
"cursor": {
"title": "Kurzor",
diff --git a/src/i18n/locales/de/settings.json b/src/i18n/locales/de/settings.json
index 654ee165e..7c42f359d 100644
--- a/src/i18n/locales/de/settings.json
+++ b/src/i18n/locales/de/settings.json
@@ -381,7 +381,6 @@
"previewHold": "Gedrückt halten für die Zoom-Vorschau",
"customScale": "Eigener Zoom",
"customScaleRange": "Der Zoom reicht von {{min}}× bis {{max}}×",
- "levelBlurs": "Über {{max}}× würde diese Aufnahme mehr als 2× vergrößert und unscharf.",
"selectRegion": "Wähle einen Zoom-Bereich zum Anpassen",
"cursor": {
"title": "Cursor",
diff --git a/src/i18n/locales/en/settings.json b/src/i18n/locales/en/settings.json
index 5f29abb3c..d65caa692 100644
--- a/src/i18n/locales/en/settings.json
+++ b/src/i18n/locales/en/settings.json
@@ -381,7 +381,6 @@
"previewHold": "Hold to preview zoom effect",
"customScale": "Custom zoom",
"customScaleRange": "Zoom goes from {{min}}× to {{max}}×",
- "levelBlurs": "Past {{max}}×, this recording would be enlarged more than 2× and blur.",
"selectRegion": "Select a zoom region to adjust",
"cursor": {
"title": "Cursor",
diff --git a/src/i18n/locales/es/settings.json b/src/i18n/locales/es/settings.json
index 93c463f1e..c7bdcfcf3 100644
--- a/src/i18n/locales/es/settings.json
+++ b/src/i18n/locales/es/settings.json
@@ -381,7 +381,6 @@
"previewHold": "Mantener para previsualizar el efecto de zoom",
"customScale": "Zoom personalizado",
"customScaleRange": "El zoom va de {{min}}× a {{max}}×",
- "levelBlurs": "Por encima de {{max}}×, esta grabación se ampliaría más de 2× y se vería borrosa.",
"selectRegion": "Selecciona una región de zoom para ajustar",
"cursor": {
"title": "Cursor",
diff --git a/src/i18n/locales/fr/settings.json b/src/i18n/locales/fr/settings.json
index ddfb18735..c7306d398 100644
--- a/src/i18n/locales/fr/settings.json
+++ b/src/i18n/locales/fr/settings.json
@@ -381,7 +381,6 @@
"previewHold": "Maintenir pour prévisualiser l'effet de zoom",
"customScale": "Zoom personnalisé",
"customScaleRange": "Le zoom va de {{min}}× à {{max}}×",
- "levelBlurs": "Au-delà de {{max}}×, cet enregistrement serait agrandi plus de 2× et deviendrait flou.",
"selectRegion": "Sélectionnez une région de zoom à ajuster",
"cursor": {
"title": "Curseur",
diff --git a/src/i18n/locales/it/settings.json b/src/i18n/locales/it/settings.json
index 8b8062379..20e8f5558 100644
--- a/src/i18n/locales/it/settings.json
+++ b/src/i18n/locales/it/settings.json
@@ -381,7 +381,6 @@
"previewHold": "Tieni premuto per vedere l'anteprima dell'effetto zoom",
"customScale": "Zoom personalizzato",
"customScaleRange": "Lo zoom va da {{min}}× a {{max}}×",
- "levelBlurs": "Oltre {{max}}×, questa registrazione verrebbe ingrandita più di 2× e risulterebbe sfocata.",
"selectRegion": "Seleziona una regione zoom da regolare",
"cursor": {
"title": "Cursore",
diff --git a/src/i18n/locales/ja-JP/settings.json b/src/i18n/locales/ja-JP/settings.json
index e9aa09f79..eb10e5252 100644
--- a/src/i18n/locales/ja-JP/settings.json
+++ b/src/i18n/locales/ja-JP/settings.json
@@ -381,7 +381,6 @@
"previewHold": "押している間ズーム効果をプレビュー",
"customScale": "カスタムズーム",
"customScaleRange": "ズーム倍率は{{min}}×から{{max}}×までです",
- "levelBlurs": "{{max}}×を超えると、この録画は2倍以上に拡大されてぼやけます。",
"selectRegion": "ズーム範囲を選択して調整",
"cursor": {
"title": "カーソル",
diff --git a/src/i18n/locales/ko-KR/settings.json b/src/i18n/locales/ko-KR/settings.json
index b292f2f14..fb3cb37a4 100644
--- a/src/i18n/locales/ko-KR/settings.json
+++ b/src/i18n/locales/ko-KR/settings.json
@@ -381,7 +381,6 @@
"previewHold": "누르고 있으면 줌 효과 미리보기",
"customScale": "커스텀 줌",
"customScaleRange": "줌은 {{min}}×에서 {{max}}×까지 가능합니다",
- "levelBlurs": "{{max}}×를 넘으면 이 녹화가 2배 넘게 확대되어 흐려집니다.",
"selectRegion": "조정할 줌 구간을 선택하세요",
"cursor": {
"title": "커서",
diff --git a/src/i18n/locales/pt-BR/settings.json b/src/i18n/locales/pt-BR/settings.json
index e2853f886..ebd01e628 100644
--- a/src/i18n/locales/pt-BR/settings.json
+++ b/src/i18n/locales/pt-BR/settings.json
@@ -381,7 +381,6 @@
"previewHold": "Mantenha pressionado para pré-visualizar o efeito de zoom",
"customScale": "Zoom Personalizado",
"customScaleRange": "O zoom vai de {{min}}× a {{max}}×",
- "levelBlurs": "Acima de {{max}}×, esta gravação seria ampliada mais de 2× e ficaria borrada.",
"selectRegion": "Selecione uma região de zoom para ajustar",
"cursor": {
"title": "Cursor",
diff --git a/src/i18n/locales/ru/settings.json b/src/i18n/locales/ru/settings.json
index 71b212ec6..b41116c08 100644
--- a/src/i18n/locales/ru/settings.json
+++ b/src/i18n/locales/ru/settings.json
@@ -381,7 +381,6 @@
"previewHold": "Удерживайте для предпросмотра эффекта зума",
"customScale": "Пользовательский масштаб",
"customScaleRange": "Масштаб может быть от {{min}}× до {{max}}×",
- "levelBlurs": "Выше {{max}}× эта запись увеличится более чем в 2 раза и станет размытой.",
"selectRegion": "Выберите область масштабирования для настройки",
"cursor": {
"title": "Курсор",
diff --git a/src/i18n/locales/tr/settings.json b/src/i18n/locales/tr/settings.json
index f93609c13..214b392a4 100644
--- a/src/i18n/locales/tr/settings.json
+++ b/src/i18n/locales/tr/settings.json
@@ -381,7 +381,6 @@
"previewHold": "Yakınlaştırma efektini önizlemek için basılı tutun",
"customScale": "Özel Yakınlaştırma",
"customScaleRange": "Yakınlaştırma {{min}}× ile {{max}}× arasında olabilir",
- "levelBlurs": "{{max}}× üzerinde bu kayıt 2 kattan fazla büyür ve bulanıklaşır.",
"selectRegion": "Ayarlamak için bir yakınlaştırma bölgesi seçin",
"cursor": {
"title": "İmleç",
diff --git a/src/i18n/locales/vi/settings.json b/src/i18n/locales/vi/settings.json
index 8e69782c1..ab46ef8f8 100644
--- a/src/i18n/locales/vi/settings.json
+++ b/src/i18n/locales/vi/settings.json
@@ -381,7 +381,6 @@
"previewHold": "Giữ để xem trước hiệu ứng phóng to",
"customScale": "Thu phóng tùy chỉnh",
"customScaleRange": "Mức thu phóng từ {{min}}× đến {{max}}×",
- "levelBlurs": "Vượt quá {{max}}×, bản ghi này sẽ bị phóng to hơn 2× và bị mờ.",
"selectRegion": "Chọn vùng thu phóng để điều chỉnh",
"cursor": {
"title": "Con trỏ",
diff --git a/src/i18n/locales/zh-CN/settings.json b/src/i18n/locales/zh-CN/settings.json
index 409615b6b..6eabd9da0 100644
--- a/src/i18n/locales/zh-CN/settings.json
+++ b/src/i18n/locales/zh-CN/settings.json
@@ -381,7 +381,6 @@
"previewHold": "按住预览放大效果",
"customScale": "自定义缩放",
"customScaleRange": "缩放范围为 {{min}}× 到 {{max}}×",
- "levelBlurs": "超过 {{max}}× 后,此录制内容会被放大 2 倍以上而变得模糊。",
"selectRegion": "选择要调整的缩放区域",
"cursor": {
"title": "光标",
diff --git a/src/i18n/locales/zh-TW/settings.json b/src/i18n/locales/zh-TW/settings.json
index 4a2725252..65485ee6e 100644
--- a/src/i18n/locales/zh-TW/settings.json
+++ b/src/i18n/locales/zh-TW/settings.json
@@ -381,7 +381,6 @@
"previewHold": "按住預覽放大效果",
"customScale": "自訂縮放",
"customScaleRange": "縮放範圍為 {{min}}× 到 {{max}}×",
- "levelBlurs": "超過 {{max}}× 後,此錄製內容會被放大 2 倍以上而變得模糊。",
"selectRegion": "選擇要調整的縮放區域",
"cursor": {
"title": "游標",