Merge pull request #111687 from kevinlam508/update-selection-highlight-on-hidden-select

Fix selection highlight not updating when selecting a hidden canvasitems
This commit is contained in:
Thaddeus Crews
2026-02-16 15:02:36 -06:00
2 changed files with 27 additions and 0 deletions
@@ -4492,6 +4492,32 @@ void CanvasItemEditor::_selection_changed() {
temp_pivot = Vector2(Math::INF, Math::INF);
viewport->queue_redraw();
}
// Check to redraw to clear anything drawn from visible selections if no selections are visible.
bool has_visible = false;
for (const KeyValue<ObjectID, Object *> &E : editor_selection->get_selection()) {
CanvasItem *ci = ObjectDB::get_instance<CanvasItem>(E.key);
if (!ci || !ci->is_visible_in_tree()) {
continue;
}
Viewport *vp = ci->get_viewport();
if (vp && !vp->is_visible_subviewport()) {
continue;
}
CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(ci);
if (se) {
has_visible = true;
break;
}
}
if (had_visible_selection != has_visible) {
if (!has_visible) {
viewport->queue_redraw();
}
had_visible_selection = has_visible;
}
}
void CanvasItemEditor::edit(CanvasItem *p_canvas_item) {
+1
View File
@@ -234,6 +234,7 @@ private:
real_t resample_delay = 0.3;
bool selected_from_canvas = false;
bool had_visible_selection = false;
// Defaults are defined in clear().
Point2 grid_offset;