This repository was archived by the owner on Aug 13, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,25 @@ var FrameList = React.createClass({
3434 return { data : [ ] } ;
3535 } ,
3636
37+ componentDidUpdate : function ( ) {
38+ var bubble = document . querySelector ( ".frameBubble.selected" ) ;
39+ if ( bubble ) {
40+ this . ensureVisible ( bubble ) ;
41+ }
42+ } ,
43+
44+ ensureVisible : function ( bubble ) {
45+ var content = document . querySelector ( ".mainPanelContent" ) ;
46+
47+ if ( bubble . offsetTop < content . scrollTop ) {
48+ content . scrollTop = bubble . offsetTop - 45 ; // minus padding
49+ }
50+
51+ if ( bubble . offsetTop + bubble . offsetHeight > content . scrollTop + content . clientHeight ) {
52+ content . scrollTop = bubble . offsetTop + bubble . offsetHeight - content . clientHeight ;
53+ }
54+ } ,
55+
3756 render : function ( ) {
3857 var { frames, summary, filter } = this . props . frames ;
3958 frames = filter . frames || frames ;
Original file line number Diff line number Diff line change @@ -28,6 +28,25 @@ var FrameTable = React.createClass({
2828
2929 displayName : "FrameTable" ,
3030
31+ componentDidUpdate : function ( ) {
32+ var row = document . querySelector ( ".frameRow.selected" ) ;
33+ if ( row ) {
34+ this . ensureVisible ( row ) ;
35+ }
36+ } ,
37+
38+ ensureVisible : function ( row ) {
39+ var content = document . querySelector ( ".mainPanelContent" ) ;
40+
41+ if ( row . offsetTop < content . scrollTop ) {
42+ content . scrollTop = row . offsetTop ;
43+ }
44+
45+ if ( row . offsetTop + row . offsetHeight > content . scrollTop + content . clientHeight ) {
46+ content . scrollTop = row . offsetTop + row . offsetHeight - content . clientHeight ;
47+ }
48+ } ,
49+
3150 render : function ( ) {
3251 var { frames, summary, filter} = this . props . frames ;
3352 frames = filter . frames || frames ;
You can’t perform that action at this time.
0 commit comments