Skip to content

Commit 6ebc5f0

Browse files
author
p01
committed
Scroll highlighted resource into view
1 parent ee956fb commit 6ebc5f0

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/resource-manager/resource_service.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,18 @@ cls.ResourceInspector = function(network_logger)
276276
if (e)
277277
{
278278
e.addClass(HIGHLIGHT_CLASSNAME);
279-
// todo: scroll into view
279+
280+
// scroll into view
281+
var container = this.tree_view.get_container().firstChild;
282+
var e_top = e.offsetTop;
283+
var e_bottom = e_top + e.offsetHeight;
284+
var container_top = container.scrollTop;
285+
var container_height = container.offsetHeight;
286+
287+
if (e_top < container_top)
288+
container.scrollTop = e_top;
289+
else if (e_bottom > container_top + container_height)
290+
container.scrollTop = e_bottom - container_height;
280291
}
281292
}.bind(this);
282293

0 commit comments

Comments
 (0)