From 0eec9c450fe7f1f35e0b2462c44e33b97254417a Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Tue, 13 Oct 2026 14:21:50 +0300 Subject: [PATCH] feat(input): lock the next point to a typed --- locales/ar-SA/opencadstudio.ftl | 1 + locales/bg-BG/opencadstudio.ftl | 1 + locales/cs-CZ/opencadstudio.ftl | 1 + locales/de-DE/opencadstudio.ftl | 1 + locales/el-GR/opencadstudio.ftl | 1 + locales/en-US/opencadstudio.ftl | 1 + locales/es-ES/opencadstudio.ftl | 1 + locales/fi-FI/opencadstudio.ftl | 1 + locales/fr-FR/opencadstudio.ftl | 1 + locales/hi-IN/opencadstudio.ftl | 1 + locales/hu-HU/opencadstudio.ftl | 1 + locales/it-IT/opencadstudio.ftl | 1 + locales/ja-JP/opencadstudio.ftl | 1 + locales/ko-KR/opencadstudio.ftl | 1 + locales/lo-LA/opencadstudio.ftl | 1 + locales/nl-NL/opencadstudio.ftl | 1 + locales/pl-PL/opencadstudio.ftl | 1 + locales/pt-BR/opencadstudio.ftl | 1 + locales/ru-RU/opencadstudio.ftl | 1 + locales/tr-TR/opencadstudio.ftl | 1 + locales/zh-CN/opencadstudio.ftl | 1 + locales/zh-TW/opencadstudio.ftl | 1 + src/app/command_driver/utilities.rs | 13 ++++++++++++- src/app/mod.rs | 4 ++++ src/app/update/command.rs | 30 +++++++++++++++++++++++++++++ src/app/update/dynamic.rs | 4 ++++ src/app/update/viewport.rs | 4 ++++ src/locale_catalog.rs | 1 + 28 files changed, 77 insertions(+), 1 deletion(-) diff --git a/locales/ar-SA/opencadstudio.ftl b/locales/ar-SA/opencadstudio.ftl index 03f5e8fa0..6cf05bb03 100644 --- a/locales/ar-SA/opencadstudio.ftl +++ b/locales/ar-SA/opencadstudio.ftl @@ -294,6 +294,7 @@ command-copy = .mode = COPY أدخل خيار وضع النسخ [Single/Multiple] : common = + .angle-override-shown = تجاوز الزاوية: __ocs_fmt_0__ .plot-preview-task = معاينة الطباعة .link-a-csv-data-source = ربط مصدر بيانات CSV .csv-files = ملفات CSV diff --git a/locales/bg-BG/opencadstudio.ftl b/locales/bg-BG/opencadstudio.ftl index 46eb97a43..f7798179b 100644 --- a/locales/bg-BG/opencadstudio.ftl +++ b/locales/bg-BG/opencadstudio.ftl @@ -281,6 +281,7 @@ command-copy = .displacement = COPY Задайте преместване: .mode = COPY Въведете режим на копиране [Single/Multiple] : common = + .angle-override-shown = Замяна на ъгъла: __ocs_fmt_0__ .plot-preview-task = Преглед на печата .link-a-csv-data-source = Свързване на CSV източник на данни .csv-files = CSV файлове diff --git a/locales/cs-CZ/opencadstudio.ftl b/locales/cs-CZ/opencadstudio.ftl index 0d0f71adc..3661065e4 100644 --- a/locales/cs-CZ/opencadstudio.ftl +++ b/locales/cs-CZ/opencadstudio.ftl @@ -281,6 +281,7 @@ command-copy = .mode = COPY Zadejte režim kopírování [Single/Multiple] : common = + .angle-override-shown = Přepsání úhlu: __ocs_fmt_0__ .plot-preview-task = Náhled tisku .link-a-csv-data-source = Propojit zdroj dat CSV .csv-files = Soubory CSV diff --git a/locales/de-DE/opencadstudio.ftl b/locales/de-DE/opencadstudio.ftl index 2aaced1db..cd0cb13ae 100644 --- a/locales/de-DE/opencadstudio.ftl +++ b/locales/de-DE/opencadstudio.ftl @@ -282,6 +282,7 @@ command-copy = .mode = COPY Kopiermodus eingeben [Single/Multiple] : common = + .angle-override-shown = Winkelvorgabe: __ocs_fmt_0__ .plot-preview-task = Plotvorschau .link-a-csv-data-source = CSV-Datenquelle verknüpfen .csv-files = CSV-Dateien diff --git a/locales/el-GR/opencadstudio.ftl b/locales/el-GR/opencadstudio.ftl index d02b193d4..46e9d4d71 100644 --- a/locales/el-GR/opencadstudio.ftl +++ b/locales/el-GR/opencadstudio.ftl @@ -281,6 +281,7 @@ command-copy = .mode = COPY Επιλέξτε λειτουργία αντιγραφής [Single/Multiple] : common = + .angle-override-shown = Παράκαμψη γωνίας: __ocs_fmt_0__ .plot-preview-task = Προεπισκόπηση εκτύπωσης .link-a-csv-data-source = Σύνδεση πηγής δεδομένων CSV .csv-files = Αρχεία CSV diff --git a/locales/en-US/opencadstudio.ftl b/locales/en-US/opencadstudio.ftl index b87ec7409..bbb98097d 100644 --- a/locales/en-US/opencadstudio.ftl +++ b/locales/en-US/opencadstudio.ftl @@ -281,6 +281,7 @@ command-copy = .mode = COPY Enter a copy mode option [Single/Multiple] : common = + .angle-override-shown = Angle Override: __ocs_fmt_0__ .browser-cannot-open-typed-path = The browser cannot open a typed path; pick the file instead. .recover-drawing = Recover Drawing .requires-0-or-1-or-keyword = Requires 0 or 1 only, or option keyword. diff --git a/locales/es-ES/opencadstudio.ftl b/locales/es-ES/opencadstudio.ftl index c2c6d7fe2..554d1c5ad 100644 --- a/locales/es-ES/opencadstudio.ftl +++ b/locales/es-ES/opencadstudio.ftl @@ -282,6 +282,7 @@ command-copy = .mode = COPY Indique modo de copia [Single/Multiple] : common = + .angle-override-shown = Modificación de ángulo: __ocs_fmt_0__ .plot-preview-task = Vista previa de trazado .link-a-csv-data-source = Vincular un origen de datos CSV .csv-files = Archivos CSV diff --git a/locales/fi-FI/opencadstudio.ftl b/locales/fi-FI/opencadstudio.ftl index 5a4aa57c0..375a601ca 100644 --- a/locales/fi-FI/opencadstudio.ftl +++ b/locales/fi-FI/opencadstudio.ftl @@ -281,6 +281,7 @@ command-copy = .mode = COPY Valitse kopiointitila [Single/Multiple] : common = + .angle-override-shown = Kulman ohitus: __ocs_fmt_0__ .plot-preview-task = Tulostuksen esikatselu .link-a-csv-data-source = Linkitä CSV-tietolähde .csv-files = CSV-tiedostot diff --git a/locales/fr-FR/opencadstudio.ftl b/locales/fr-FR/opencadstudio.ftl index df598d690..28ae934ca 100644 --- a/locales/fr-FR/opencadstudio.ftl +++ b/locales/fr-FR/opencadstudio.ftl @@ -282,6 +282,7 @@ command-copy = .mode = COPY Entrez le mode de copie [Single/Multiple] : common = + .angle-override-shown = Remplacement d’angle : __ocs_fmt_0__ .plot-preview-task = Aperçu du tracé .link-a-csv-data-source = Lier une source de données CSV .csv-files = Fichiers CSV diff --git a/locales/hi-IN/opencadstudio.ftl b/locales/hi-IN/opencadstudio.ftl index c547fe085..cdaf7c092 100644 --- a/locales/hi-IN/opencadstudio.ftl +++ b/locales/hi-IN/opencadstudio.ftl @@ -270,6 +270,7 @@ command-copy = .mode = COPY कॉपी मोड विकल्प दर्ज करें [Single/Multiple] : common = + .angle-override-shown = कोण ओवरराइड: __ocs_fmt_0__ .plot-preview-task = प्लॉट पूर्वावलोकन .link-a-csv-data-source = CSV डेटा स्रोत लिंक करें .csv-files = CSV फ़ाइलें diff --git a/locales/hu-HU/opencadstudio.ftl b/locales/hu-HU/opencadstudio.ftl index 75ca52493..54b476fc8 100644 --- a/locales/hu-HU/opencadstudio.ftl +++ b/locales/hu-HU/opencadstudio.ftl @@ -280,6 +280,7 @@ command-copy = .mode = COPY Adja meg a másolási módot [Single/Multiple] : common = + .angle-override-shown = Szög felülbírálása: __ocs_fmt_0__ .parametric-coincident = Egybeeső .parametric-colinear = Egy egyenesbe eső .parametric-concentric = Koncentrikus diff --git a/locales/it-IT/opencadstudio.ftl b/locales/it-IT/opencadstudio.ftl index f61473e05..facf64bf4 100644 --- a/locales/it-IT/opencadstudio.ftl +++ b/locales/it-IT/opencadstudio.ftl @@ -281,6 +281,7 @@ command-copy = .mode = COPY Specificare modalità di copia [Single/Multiple] : common = + .angle-override-shown = Sostituzione angolo: __ocs_fmt_0__ .plot-preview-task = Anteprima di stampa .link-a-csv-data-source = Collega un'origine dati CSV .csv-files = File CSV diff --git a/locales/ja-JP/opencadstudio.ftl b/locales/ja-JP/opencadstudio.ftl index c7f513a9c..7e27c2697 100644 --- a/locales/ja-JP/opencadstudio.ftl +++ b/locales/ja-JP/opencadstudio.ftl @@ -272,6 +272,7 @@ command-copy = .mode = COPY コピーモードを入力 [Single/Multiple] : common = + .angle-override-shown = 角度の優先: __ocs_fmt_0__ .plot-preview-task = 印刷プレビュー .link-a-csv-data-source = CSV データ ソースをリンク .csv-files = CSV ファイル diff --git a/locales/ko-KR/opencadstudio.ftl b/locales/ko-KR/opencadstudio.ftl index 76415f832..7bd6325f7 100644 --- a/locales/ko-KR/opencadstudio.ftl +++ b/locales/ko-KR/opencadstudio.ftl @@ -281,6 +281,7 @@ command-copy = .mode = COPY 복사 모드 옵션 입력 [Single/Multiple] : common = + .angle-override-shown = 각도 재지정: __ocs_fmt_0__ .plot-preview-task = 플롯 미리 보기 .link-a-csv-data-source = CSV 데이터 원본 연결 .csv-files = CSV 파일 diff --git a/locales/lo-LA/opencadstudio.ftl b/locales/lo-LA/opencadstudio.ftl index 3f96eff07..f4419053f 100644 --- a/locales/lo-LA/opencadstudio.ftl +++ b/locales/lo-LA/opencadstudio.ftl @@ -281,6 +281,7 @@ command-copy = .mode = COPY ປ້ອນຕົວເລືອກໂໝດການຄັດລອກ [Single/Multiple] : common = + .angle-override-shown = ກຳນົດມຸມແທນ: __ocs_fmt_0__ .remote-image-url-could-not-be-fetched-the-request-timed-out = ບໍ່ສາມາດດຶງຮູບພາບທາງໄກ "__ocs_fmt_0__" ໄດ້: ການຮ້ອງຂໍໝົດເວລາ. .remote-image-url-was-not-loaded-it-exceeds-the-64-mb-remote-image-limit = ບໍ່ໄດ້ໂຫຼດຮູບພາບທາງໄກ "__ocs_fmt_0__": ມັນເກີນຂີດຈຳກັດ 64 MB ຂອງຮູບພາບທາງໄກ. .remote-image-url-could-not-be-fetched-the-server-returned-http-status = ບໍ່ສາມາດດຶງຮູບພາບທາງໄກ "__ocs_fmt_0__" ໄດ້: ເຊີບເວີຕອບກັບ HTTP __ocs_fmt_1__. diff --git a/locales/nl-NL/opencadstudio.ftl b/locales/nl-NL/opencadstudio.ftl index a457b9126..7c6cf1aba 100644 --- a/locales/nl-NL/opencadstudio.ftl +++ b/locales/nl-NL/opencadstudio.ftl @@ -282,6 +282,7 @@ command-copy = .mode = COPY Geef kopieermodus op [Single/Multiple] : common = + .angle-override-shown = Hoekoverschrijving: __ocs_fmt_0__ .plot-preview-task = Plotvoorbeeld .link-a-csv-data-source = CSV-gegevensbron koppelen .csv-files = CSV-bestanden diff --git a/locales/pl-PL/opencadstudio.ftl b/locales/pl-PL/opencadstudio.ftl index 9ac814495..4f3468a57 100644 --- a/locales/pl-PL/opencadstudio.ftl +++ b/locales/pl-PL/opencadstudio.ftl @@ -281,6 +281,7 @@ command-copy = .mode = COPY Podaj tryb kopiowania [Single/Multiple] : common = + .angle-override-shown = Zastąpienie kąta: __ocs_fmt_0__ .plot-preview-task = Podgląd wydruku .link-a-csv-data-source = Połącz źródło danych CSV .csv-files = Pliki CSV diff --git a/locales/pt-BR/opencadstudio.ftl b/locales/pt-BR/opencadstudio.ftl index 790d736dc..3861a9dbd 100644 --- a/locales/pt-BR/opencadstudio.ftl +++ b/locales/pt-BR/opencadstudio.ftl @@ -282,6 +282,7 @@ command-copy = .mode = COPY Informe o modo de cópia [Single/Multiple] : common = + .angle-override-shown = Substituição de ângulo: __ocs_fmt_0__ .plot-preview-task = Visualização da plotagem .link-a-csv-data-source = Vincular uma fonte de dados CSV .csv-files = Arquivos CSV diff --git a/locales/ru-RU/opencadstudio.ftl b/locales/ru-RU/opencadstudio.ftl index 391749df5..20aff58e8 100644 --- a/locales/ru-RU/opencadstudio.ftl +++ b/locales/ru-RU/opencadstudio.ftl @@ -285,6 +285,7 @@ command-copy = .mode = COPY Задайте режим копирования [Single/Multiple] : common = + .angle-override-shown = Переопределение угла: __ocs_fmt_0__ .plot-preview-task = Предварительный просмотр печати .link-a-csv-data-source = Связать источник данных CSV .csv-files = Файлы CSV diff --git a/locales/tr-TR/opencadstudio.ftl b/locales/tr-TR/opencadstudio.ftl index 8da009c68..4a6d6f26c 100644 --- a/locales/tr-TR/opencadstudio.ftl +++ b/locales/tr-TR/opencadstudio.ftl @@ -267,6 +267,7 @@ command-copy = .mode = COPY Kopyalama modu seçin [Single/Multiple] : common = + .angle-override-shown = Açı geçersiz kılma: __ocs_fmt_0__ .plot-preview-task = Çizim önizleme .link-a-csv-data-source = CSV veri kaynağı bağla .csv-files = CSV Dosyaları diff --git a/locales/zh-CN/opencadstudio.ftl b/locales/zh-CN/opencadstudio.ftl index e88472968..6ea365f46 100644 --- a/locales/zh-CN/opencadstudio.ftl +++ b/locales/zh-CN/opencadstudio.ftl @@ -269,6 +269,7 @@ command-copy = .mode = COPY 输入复制模式选项 [Single/Multiple] : common = + .angle-override-shown = 角度替代:__ocs_fmt_0__ .plot-preview-task = 打印预览 .link-a-csv-data-source = 链接 CSV 数据源 .csv-files = CSV 文件 diff --git a/locales/zh-TW/opencadstudio.ftl b/locales/zh-TW/opencadstudio.ftl index 290a82806..b33c7307f 100644 --- a/locales/zh-TW/opencadstudio.ftl +++ b/locales/zh-TW/opencadstudio.ftl @@ -281,6 +281,7 @@ command-copy = .mode = COPY 輸入複製模式選項 [Single/Multiple] : common = + .angle-override-shown = 角度取代:__ocs_fmt_0__ .plot-preview-task = 出圖預覽 .link-a-csv-data-source = 連結 CSV 資料來源 .csv-files = CSV 檔案 diff --git a/src/app/command_driver/utilities.rs b/src/app/command_driver/utilities.rs index 2f995013f..720c9153c 100644 --- a/src/app/command_driver/utilities.rs +++ b/src/app/command_driver/utilities.rs @@ -98,6 +98,7 @@ impl OpenCADStudio { self.otrack_cross = None; self.otrack_kind = None; self.axis_lock_dir = None; + self.angle_override = None; self.dyn_user_reshaped = false; self.dyn_coord_absolute = false; self.grip_hover = None; @@ -595,6 +596,7 @@ impl OpenCADStudio { if !self.command_point_allowed(i, *point) { return (Task::none(), true); } + self.angle_override = None; // Typed / dynamic-input / headless points carry no snap, but the // accepted-snap list must stay index-parallel with the points the // command collects. Interactive picks record themselves in @@ -1130,6 +1132,9 @@ impl OpenCADStudio { self.apply_snap_override(kind); return Task::none(); } + if self.try_angle_override(token) { + return Task::none(); + } if let Some((coord, kind)) = crate::app::helpers::parse_coord(token) { // Match the GUI command line: typed coordinates are in the active // UCS (relative offsets are rotated by the UCS axes), so a multi- @@ -1161,7 +1166,13 @@ impl OpenCADStudio { // bare number is the step's own value, not a distance — ROTATE's // angle, SCALE's factor, CIRCLE's radius. Only a token no step // claims becomes direct distance entry, measured along the cursor - // direction from the command's anchor. + // direction from the command's anchor. Under a typed `, + /// A direction typed as `, /// Inline rename state: (original_name, current_edit_value). layout_rename_state: Option<(String, String)>, /// Timestamp of the previous viewport left-click release (for double-click detection). @@ -4775,6 +4778,7 @@ impl OpenCADStudio { text_inline: None, snap_override_popup: None, axis_lock_dir: None, + angle_override: None, layout_rename_state: None, last_vp_click_time: None, last_vp_click_pos: None, diff --git a/src/app/update/command.rs b/src/app/update/command.rs index c84c6f7f6..106e3cf10 100644 --- a/src/app/update/command.rs +++ b/src/app/update/command.rs @@ -868,6 +868,13 @@ impl OpenCADStudio { if let Some(task) = self.try_selection_keyword(&text) { return task; } + // Under a typed ` bool { + let (Some(angle), Some(_)) = (text.trim().strip_prefix('<'), self.last_point) else { + return false; + }; + let Some(angle) = crate::entities::common::parse_typed_direction(angle) else { + return false; + }; + let local = glam::DVec3::new(angle.cos(), angle.sin(), 0.0); + self.angle_override = Some(match &self.tabs[self.active_tab].active_ucs { + Some(ucs) => ucs_rotate_vec(local, ucs), + None => local, + }); + let shown = crate::entities::common::format_direction(angle); + self.command_line.push_output(crate::tf!("Angle Override: {shown}").as_ref()); + true + } + pub(in crate::app) fn try_direct_distance_entry( &mut self, text: &str, diff --git a/src/app/update/dynamic.rs b/src/app/update/dynamic.rs index a27a851c3..421b8c94c 100644 --- a/src/app/update/dynamic.rs +++ b/src/app/update/dynamic.rs @@ -29,6 +29,10 @@ impl OpenCADStudio { &self, i: usize, ) -> Option<(glam::DVec3, glam::DVec3)> { + // A typed ` Option { + if let Some(direction) = self.angle_override.filter(|_| allowed) { + self.axis_lock_dir = Some(direction); + return self.axis_lock_dir; + } if self.shift_down && allowed { if self.axis_lock_dir.is_none() { let ucs = self.tabs[tab].ucs_xform(); diff --git a/src/locale_catalog.rs b/src/locale_catalog.rs index 63a1dce3a..d277ff0e8 100644 --- a/src/locale_catalog.rs +++ b/src/locale_catalog.rs @@ -5844,6 +5844,7 @@ pub(super) fn message_attribute(source: &str) -> Option<(&'static str, &'static "Requires 0 or 1 only." => Some(("count-feature", "requires-0-or-1")), "Requires 0 or 1 only, or option keyword." => Some(("common", "requires-0-or-1-or-keyword")), "Requires a number." => Some(("common", "requires-a-number")), + "Angle Override: {shown}" => Some(("common", "angle-override-shown")), "{name} ...... {n}" => Some(("count-feature", "target-count")), "MTEXT Current text style: \"{}\" Text height: {:.4}" => Some(("count-feature", "mtext-current-style")), "{found} field(s) found." => Some(("count-feature", "fields-found")),