Skip to content

Commit 6441ddb

Browse files
author
Chris K
committed
DFL-3662 view-slider for overlay views is never removed.
1 parent c89a13b commit 6441ddb

File tree

2 files changed

+36
-12
lines changed

2 files changed

+36
-12
lines changed

src/ui-scripts/celloverlay.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ var CellOverlayPrototype = function()
7474
if (parent_toolbar)
7575
parent_toolbar.enable();
7676
this.is_active = false;
77-
this.remove_ui_elements(this.view_id);
77+
this.remove_ui_elements(this.view_id, true);
7878
};
7979
};
8080

src/ui-scripts/cells.js

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -170,29 +170,53 @@
170170
this.overlay.hide();
171171
};
172172

173-
this.remove_ui_elements = function(view_id)
173+
this.remove_ui_elements = function(view_id, starting_from_parent)
174174
{
175175
var view = window.views[view_id];
176176
if (view && view.isvisible())
177177
{
178178
var cell = this.get_cell(view_id);
179-
var container_id = "container-to-" + cell.id;
179+
if (starting_from_parent)
180+
{
181+
var parent_cell = cell && cell.parent;
182+
if (parent_cell)
183+
{
184+
for (var i = 0, cell; cell = parent_cell.children[i]; i++)
185+
{
186+
this._remove_ui_elemnts(cell, view_id);
187+
}
188+
}
189+
}
190+
else
191+
this._remove_ui_elemnts(cell, view_id);
192+
}
193+
};
194+
195+
this._remove_ui_elemnts = function(cell, view_id)
196+
{
197+
if (!cell)
198+
return;
199+
200+
var container_id = "container-to-" + cell.id;
201+
var view = cell.tab && window.views[cell.tab.activeTab];
202+
if (view)
203+
{
180204
window.messages.post("hide-view", {id: view_id});
181205
view.removeContainerId(container_id);
182206
var toolbar_id = "toolbar-to-" + cell.id;
183207
var toolbar = window.toolbars[view_id];
184208
if (toolbar)
185209
toolbar.removeContainerId(toolbar_id);
186-
[container_id,
187-
toolbar_id,
188-
"overlay-background-to-" + cell.id,
189-
"slider-for-" + cell.id].forEach(function(id)
190-
{
191-
var ele = document.getElementById(id);
192-
if (ele)
193-
ele.parentNode.removeChild(ele);
194-
});
195210
}
211+
[container_id,
212+
toolbar_id,
213+
"overlay-background-to-" + cell.id,
214+
"slider-for-" + cell.id].forEach(function(id)
215+
{
216+
var ele = document.getElementById(id);
217+
if (ele)
218+
ele.parentNode.removeChild(ele);
219+
});
196220
};
197221

198222
this.add_searchbar = function(searchbar)

0 commit comments

Comments
 (0)