diff --git a/devel/201_37.md b/devel/201_37.md new file mode 100644 index 0000000000000000000000000000000000000000..2c8d38b2230f8f5b95dd397796cb715114346f34 --- /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 7650a251ef8cf680804f8d2b851c3a21db0cc67b..3eef516a91a20020d3687e127de372f341fd71a9 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 2b55cbc7bbcfebbad0a41c7d49b54bfe36a0edd1..0cfdbee7ae08e773d5db7c355aa8c55378572d0e 100644 --- a/src/Plugins/Qt/qt_gui.cpp +++ b/src/Plugins/Qt/qt_gui.cpp @@ -377,7 +377,10 @@ 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;