From 60cadd95ed35f094100770a9c625f5bbb9ca563a Mon Sep 17 00:00:00 2001 From: Yuki Date: Mon, 8 Dec 2025 10:43:41 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=9C=A8=E5=9B=BE=E7=89=87=E5=A4=96?= =?UTF-8?q?=E9=9D=A2=E5=A2=9E=E5=8A=A0=E8=BE=B9=E7=95=8C=E6=A1=86resize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- devel/201_37.md | 13 +++++++++++++ src/Edit/Modify/edit_text.cpp | 4 +++- src/Plugins/Qt/qt_gui.cpp | 4 +++- 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 devel/201_37.md diff --git a/devel/201_37.md b/devel/201_37.md new file mode 100644 index 000000000..2c8d38b22 --- /dev/null +++ b/devel/201_37.md @@ -0,0 +1,13 @@ +# 201_37 优化图片旋转功能 + +## 如何测试 + +- 插入一张图片(注意:不要使用 图片及题注) +- 点击`格式 -> 变换 -> 旋转`看能否以图片为中心进行旋转 + +## 2025/12/05 +### What +给图片外面包裹一层`resize`,用边界框约束旋转。 + +### Why +图片如果设置旋转,会到编辑区域外面,这是不对的。 \ No newline at end of file diff --git a/src/Edit/Modify/edit_text.cpp b/src/Edit/Modify/edit_text.cpp index 7650a251e..3eef516a9 100644 --- a/src/Edit/Modify/edit_text.cpp +++ b/src/Edit/Modify/edit_text.cpp @@ -390,5 +390,7 @@ edit_text_rep::make_image (string file_name, bool link, string w, string h, t << tuple (tree (RAW_DATA, s), utf8_to_cork (as_string (tail (image)))); } t << tree (w) << tree (h) << tree (x) << tree (y); - insert_tree (t); + tree wrapped_t (RESIZE); + wrapped_t << t << "" << "" << "" << ""; + insert_tree (wrapped_t); } diff --git a/src/Plugins/Qt/qt_gui.cpp b/src/Plugins/Qt/qt_gui.cpp index 2b55cbc7b..04df14e51 100644 --- a/src/Plugins/Qt/qt_gui.cpp +++ b/src/Plugins/Qt/qt_gui.cpp @@ -377,7 +377,9 @@ qt_gui_rep::get_selection (string key, tree& t, string& s, string format) { tree t (IMAGE); t << tuple (tree (RAW_DATA, s), clipboard_image_suffix) << image_w_string << image_h_string << "" << ""; - s= as_string (call ("convert", t, "texmacs-tree", "texmacs-snippet")); + tree wrapped_t (RESIZE); + wrapped_t << t << "" << "" << "" << ""; + s= as_string (call ("convert", wrapped_t, "texmacs-tree", "texmacs-snippet")); } t= tuple ("extern", s); return true; -- Gitee From 36cb6f309ecae44791c78dfd5cb6991444d3eb1c Mon Sep 17 00:00:00 2001 From: Yuki Date: Mon, 8 Dec 2025 10:44:20 +0800 Subject: [PATCH 2/2] wip --- src/Plugins/Qt/qt_gui.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Plugins/Qt/qt_gui.cpp b/src/Plugins/Qt/qt_gui.cpp index 04df14e51..0cfdbee7a 100644 --- a/src/Plugins/Qt/qt_gui.cpp +++ b/src/Plugins/Qt/qt_gui.cpp @@ -379,7 +379,8 @@ qt_gui_rep::get_selection (string key, tree& t, string& s, string format) { << image_h_string << "" << ""; tree wrapped_t (RESIZE); wrapped_t << t << "" << "" << "" << ""; - s= as_string (call ("convert", wrapped_t, "texmacs-tree", "texmacs-snippet")); + s= as_string ( + call ("convert", wrapped_t, "texmacs-tree", "texmacs-snippet")); } t= tuple ("extern", s); return true; -- Gitee