diff --git a/devel/201_84.md b/devel/201_84.md new file mode 100644 index 0000000000..93e98cf15b --- /dev/null +++ b/devel/201_84.md @@ -0,0 +1,15 @@ +# [201_84] 默认关闭矩阵等数学环境的格线拖拽 + +## 如何测试 +1. 插入任意样式的正常表格(大表格、小表格除外),格线应该可以正常拖拽 +2. 插入`matrix`、`bmatrix`、`Bmatrix`、`det`、`choice`、`stack`等数学环境,格线应该不支持拖拽 +3. 插入`align`、`eqnarray`、`gather`、`multline`、`alignat`、`flalign`等数学环境,格线也应该不支持拖拽 + +## 2026/2/13 +### What +在诸多以表格为底层数据模型的数学环境下,很多组件在编辑时,格线不应支持拖拽 + +### How +1. 在`edit_interface_rep::is_true_table`中,增加对诸多数学环境的判断 +2. 在`edit_mouse::table_line_hit`中,增加对`is_true_table`的判断,以保障鼠标悬浮的变形和拖动被`table_line_hit`时禁用 +3. 清除`hovering_table=-1`这个没有必要的情况分支 \ No newline at end of file diff --git a/src/Edit/Interface/edit_interface.cpp b/src/Edit/Interface/edit_interface.cpp index 66bd4d305d..c65af55272 100644 --- a/src/Edit/Interface/edit_interface.cpp +++ b/src/Edit/Interface/edit_interface.cpp @@ -1195,6 +1195,14 @@ edit_interface_rep::is_true_table (path p) { is_compound (qt, "alignat") || is_compound (qt, "alignat*") || is_compound (qt, "flalign") || is_compound (qt, "flalign*")) return false; + if (is_compound (qt, "cases") || is_compound (qt, "choice") || + is_compound (qt, "det") || is_compound (qt, "stack") || + is_compound (qt, "array") || is_compound (qt, "array*") || + is_compound (qt, "matrix") || is_compound (qt, "matrix*") || + is_compound (qt, "bmatrix") || is_compound (qt, "Bmatrix") || + is_compound (qt, "pmatrix") || is_compound (qt, "vmatrix") || + is_compound (qt, "Vmatrix") || is_compound (qt, "smallmatrix")) + return false; } return true; } diff --git a/src/Edit/Interface/edit_mouse.cpp b/src/Edit/Interface/edit_mouse.cpp index ed686b7b2b..a378f1bb61 100644 --- a/src/Edit/Interface/edit_mouse.cpp +++ b/src/Edit/Interface/edit_mouse.cpp @@ -571,7 +571,8 @@ edit_interface_rep::table_line_hit (SI x, SI y, table_hit& hit) { hit.second_size= as_int (r[5]); hit.fp = as_path (as_string (r[8])); - if (is_nil (hit.fp) || hit.index <= 0) return false; + if (is_nil (hit.fp) || hit.index <= 0 || !is_true_table (hit.fp)) + return false; return true; } @@ -822,13 +823,11 @@ edit_interface_rep::mouse_any (string type, SI x, SI y, int mods, time_t t, int hovering_table= 0; if (type == "move" || type == "dragging-left" || type == "dragging-right") { - rectangles rs; - tree r= eb->message (tree ("table-loc?"), x, y, rs); - if (is_func (r, TUPLE) && r[0] == "table-loc") { - string orient= as_string (r[1]); - if (orient == "cell") hovering_table= -1; - else if (orient == "row") hovering_table= 1; - else if (orient == "col") hovering_table= 2; + table_hit hit; + if (table_line_hit (x, y, hit)) { + if (hit.orient == "cell") hovering_table= -1; + else if (hit.orient == "row") hovering_table= 1; + else if (hit.orient == "col") hovering_table= 2; } } bool hovering_hlink= false; @@ -907,13 +906,8 @@ edit_interface_rep::mouse_any (string type, SI x, SI y, int mods, time_t t, if (handle_cursor != "") set_cursor_style (handle_cursor); else set_cursor_style ("size_all"); } - else if (hovering_table) { - if (hovering_table == -1) { - set_cursor_style ("normal"); - // draw table resizing handles - } - else set_cursor_style (hovering_table == 1 ? "size_ver" : "size_hor"); - } + else if (hovering_table) + set_cursor_style (hovering_table == 1 ? "size_ver" : "size_hor"); else if (hovering_hlink) set_cursor_style ("pointing_hand"); else if (hovering_image) { set_cursor_style ("pointing_hand");