diff --git a/src-tauri/src/locale.rs b/src-tauri/src/locale.rs index 2d3fbc0..0fcc557 100644 --- a/src-tauri/src/locale.rs +++ b/src-tauri/src/locale.rs @@ -128,7 +128,7 @@ pub fn tray_titles(language: &str) -> TrayTitles { capture: "区域截图", fullscreen: "全屏截图", record: "区域录屏", - ocr: "识别图片文字…", + ocr: "文字识别", update: "发现新版本 ", quit: "退出 Shift", } @@ -138,7 +138,7 @@ pub fn tray_titles(language: &str) -> TrayTitles { capture: "Capture area", fullscreen: "Capture full screen", record: "Record area", - ocr: "OCR an image…", + ocr: "OCR", update: "Update available ", quit: "Quit Shift", } @@ -198,9 +198,13 @@ mod tests { let chinese = tray_titles(CHINESE); assert_eq!(chinese.quit, "退出 Shift"); assert_eq!(chinese.capture, "区域截图"); + // The tray row carries the same words as the window's own OCR button, and + // no ellipsis: every other row is a command, not a preview. + assert_eq!(chinese.ocr, "文字识别"); let english = tray_titles(ENGLISH); assert_eq!(english.quit, "Quit Shift"); assert_eq!(english.capture, "Capture area"); + assert_eq!(english.ocr, "OCR"); // Chinese is the only other language, so anything else means English. assert_eq!(tray_titles("de").open, english.open); } diff --git a/src-tauri/src/update.rs b/src-tauri/src/update.rs index 882116b..b580c47 100644 --- a/src-tauri/src/update.rs +++ b/src-tauri/src/update.rs @@ -1031,6 +1031,10 @@ mod tests { assert!(version_is_newer("v1.0.0", "0.9.0")); assert!(!version_is_newer("0.1.0", "0.1.0")); assert!(!version_is_newer("0.0.9", "0.1.0")); + // 0.1.10 was the first release whose *patch* component reached two digits, so + // the double-digit rule is asserted for that position too and not just above it. + assert!(version_is_newer("0.1.10", "0.1.9")); + assert!(!version_is_newer("0.1.9", "0.1.10")); } #[test] diff --git a/src/components/MainWindow.tsx b/src/components/MainWindow.tsx index 2c12c29..aebfdd4 100644 --- a/src/components/MainWindow.tsx +++ b/src/components/MainWindow.tsx @@ -316,13 +316,15 @@ export function MainWindow() { } async function runOcrOn(paths: string[]) { - const image = paths.find((path) => OCR_EXTENSIONS.includes(extensionOf(path))); - if (!image) { - // No image in the batch: the format ring is more useful than a failing OCR run. - await api.showFilesInRadial(paths, "formats"); + // No fallback: a drop the OCR button cannot serve is refused rather than + // silently handed to another ring, which used to look like the button + // ignoring the file and doing something else instead. + const unsupported = paths.filter((path) => !OCR_EXTENSIONS.includes(extensionOf(path))); + if (unsupported.length > 0) { + flash(t("ocrUnsupported"), 2600); return; } - await api.openInEditor(image); + await api.openInEditor(paths[0]); window.setTimeout(() => { void emitTo("editor", "editor://run-ocr", {}); }, 450); @@ -350,29 +352,26 @@ export function MainWindow() { /** * Run the one action a drop was aimed at. * - * The button *is* the choice: a drop that lands on the panel rather than on one of - * the three buttons runs nothing, so the gesture can never open a ring the user did - * not ask for. `dropOnButton` says why instead of leaving the drop silent. + * The button *is* the choice. `null` means the file was released on the panel + * rather than on a button, and that runs nothing and says nothing - the same + * nothing a row released off a button does, which is why a file from outside and + * a row from the list are now one gesture with one set of consequences. */ - function dropFiles(paths: string[], action: DropAction) { + function dropFiles(paths: string[], action: DropAction | null) { if (paths.length === 0) return Promise.resolve(); + if (!action) return Promise.resolve(); if (action === "ocr") return runOcrOn(paths); return api.showFilesInRadial(paths, action).then(() => undefined); } /** - * Land a dragged Recent row, at most once per gesture. Off a button it runs nothing, - * the same rule a file from Finder follows, and says so rather than going silent. + * Land a dragged Recent row, at most once per gesture. */ function landRecentRow(action: DropAction | null) { const drag = recentDrag.current; if (!drag || drag.landed) return; drag.landed = true; setDropAction(null); - if (!action) { - flash(t("dropOnButton"), 2600); - return; - } void dropFiles([drag.path], action).catch((error) => flash(String(error), 3200)); } @@ -675,12 +674,6 @@ export function MainWindow() { landRecentRow(action); return; } - // Off a button there is no action to run, so the drop says what it expects - // instead of opening a ring the user never aimed at. - if (!action) { - flash(t("dropOnButton"), 2600); - return; - } void dropFiles(event.payload.paths, action).catch((error) => flash(String(error), 3200)); return; } @@ -816,7 +809,7 @@ export function MainWindow() { ) : null}
-
+
{screenAccess === false ? (
@@ -855,9 +848,10 @@ export function MainWindow() { ); })}
-

{dragging ? t("homeDropRelease") : t("homeDropTitle")}

- {/* While any drag is in flight all three buttons show as candidates, so the - aim is visible before the pointer reaches one. */} +

{t("homeDropTitle")}

+ {/* The buttons are the only thing a drag reacts to: while one is in flight + all three show as candidates, so the aim is visible before the pointer + reaches one, and the panel itself never animates. */}
> = { tools: "Tools", unsupported: "No formats for this file type", homeDropTitle: "Drop files to get started", - homeDropRelease: "Release over one of the buttons", homeDropHint: "Drop a file on a button to run that action.", - dropOnButton: "Drop the file on one of the three buttons.", + ocrUnsupported: "OCR works on image files only.", convertFiles: "Convert files", fileTools: "File tools", nothingYet: "Nothing yet", @@ -313,9 +312,8 @@ const messages: Record> = { tools: "工具", unsupported: "此文件类型暂时没有可用格式", homeDropTitle: "拖入文件开始处理", - homeDropRelease: "请松开在按钮上", homeDropHint: "把文件拖到对应按钮上,执行该操作。", - dropOnButton: "请把文件拖到下方三个按钮之一。", + ocrUnsupported: "文字识别仅支持图片格式。", convertFiles: "文件转换", fileTools: "文件工具", nothingYet: "暂无内容", diff --git a/src/styles.css b/src/styles.css index 4f872a3..0566db3 100644 --- a/src/styles.css +++ b/src/styles.css @@ -1648,10 +1648,6 @@ kbd { inset 0 1px 0 rgba(255, 255, 255, 0.8); text-align: center; backdrop-filter: blur(18px); - transition: - border-color 0.18s ease, - background 0.18s ease, - transform 0.18s ease; } .permission-banner { @@ -1720,16 +1716,6 @@ kbd { pointer-events: none; } -.home-drop.is-dragging { - border-color: rgba(242, 106, 51, 0.38); - background: rgba(255, 245, 235, 0.94); - transform: scale(0.995); -} - -.home-drop.is-dragging::after { - border-color: rgba(242, 106, 51, 0.58); -} - .home-drop-art { position: relative; z-index: 1;