Fix code getting items under cursor (441f5bfb) · Commits · René de Hesselle / inkscape · GitLab
Wen-Wei Kao
·
2025-12-09
·
via inkscape:windows_ci_14x commits
| Original line number |
Diff line number |
Diff line |
|
@@ -141,7 +141,7 @@ static bool childrenIncludedInSelection(SPItem *item, Inkscape::Selection &selec |
|
|
});
|
|
|
}
|
|
|
|
|
|
ContextMenu::ContextMenu(SPDesktop *desktop, SPObject *object, bool hide_layers_and_objects_menu_item)
|
|
|
ContextMenu::ContextMenu(SPDesktop *desktop, SPObject *object, std::vector<SPItem*> const &items, bool hide_layers_and_objects_menu_item)
|
|
|
{
|
|
|
set_name("ContextMenu");
|
|
|
|
|
@@ -161,8 +161,7 @@ ContextMenu::ContextMenu(SPDesktop *desktop, SPObject *object, bool hide_layers_ |
|
|
auto root = desktop->layerManager().currentRoot();
|
|
|
|
|
|
// Save the items in context
|
|
|
auto point_win = desktop->point() * desktop->d2w();
|
|
|
items_under_cursor = document->getItemsAtPoints(desktop->dkey, {point_win}, true, false);
|
|
|
items_under_cursor = items;
|
|
|
|
|
|
bool has_hidden_below_cursor = false;
|
|
|
bool has_locked_below_cursor = false;
|
|
|
| Original line number |
Diff line number |
Diff line |
|
@@ -34,7 +34,7 @@ class SPItem; |
|
|
class ContextMenu : public Gtk::Menu
|
|
|
{
|
|
|
public:
|
|
|
ContextMenu(SPDesktop *desktop, SPObject *object, bool hide_layers_and_objects_menu_item = false);
|
|
|
ContextMenu(SPDesktop *desktop, SPObject *object, std::vector<SPItem*> const &items, bool hide_layers_and_objects_menu_item = false);
|
|
|
|
|
|
private:
|
|
|
// Used for unlock and unhide actions
|
|
|
| Original line number |
Diff line number |
Diff line |
|
@@ -1645,7 +1645,7 @@ Gtk::EventSequenceState ObjectsPanel::on_click(Gtk::GestureMultiPress const &ges |
|
|
|
|
|
// true == hide menu item for opening this dialog!
|
|
|
std::vector<SPItem*> items = {item};
|
|
|
ContextMenu *menu = new ContextMenu(getDesktop(), item, true); // true == hide menu item for opening this dialog!
|
|
|
ContextMenu *menu = new ContextMenu(getDesktop(), item, items, true); // true == hide menu item for opening this dialog!
|
|
|
menu->attach_to_widget(*this); // So actions work!
|
|
|
menu->show();
|
|
|
menu->popup_at_pointer(nullptr);
|
|
|
| Original line number |
Diff line number |
Diff line |
|
@@ -1338,7 +1338,10 @@ void ToolBase::menu_popup(CanvasEvent const &event, SPObject *obj) |
|
|
}
|
|
|
}
|
|
|
|
|
|
auto menu = new ContextMenu(_desktop, obj);
|
|
|
// Get a list of items under the cursor, used for unhiding and unlocking.
|
|
|
auto point_win = _desktop->point() * _desktop->d2w();
|
|
|
auto items_under_cursor = _desktop->getItemsAtPoints({point_win}, true, false, 0, false);
|
|
|
auto menu = new ContextMenu(_desktop, obj, items_under_cursor);
|
|
|
menu->attach_to_widget(*_desktop->getCanvas()); // So actions work!
|
|
|
menu->set_visible(true);
|
|
|
|
|
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。