@@ -1772,9 +1772,6 @@ function clearSearchFrom() {
1772
1772
$ ( "#type :selected" ) . prop ( "selected" , false ) ;
1773
1773
}
1774
1774
1775
- var scope_visible = 0 ;
1776
- var scope_text = '' ;
1777
-
1778
1775
/**
1779
1776
* Fold or unfold a function definition.
1780
1777
*/
@@ -1787,30 +1784,38 @@ function fold(id) {
1787
1784
$ ( '#' + id + '_fold' ) . toggle ( 'fold' ) ;
1788
1785
}
1789
1786
1787
+ var scope_timeout = null ;
1790
1788
/**
1791
1789
* Function that is called when the #content div element is scrolled. Checks
1792
1790
* if the top of the page is inside a function scope. If so, update the
1793
1791
* scope element to show the name of the function and a link to its definition.
1794
1792
*/
1795
1793
function scope_on_scroll ( ) {
1796
- var cnt = document . getElementById ( "content" ) ;
1797
- var y = cnt . getBoundingClientRect ( ) . top + 2 ;
1798
- var c = document . elementFromPoint ( 15 , y + 1 ) ;
1794
+ if ( scope_timeout !== null ) {
1795
+ clearTimeout ( scope_timeout )
1796
+ scope_timeout = null
1797
+ }
1798
+ scope_timeout = setTimeout ( function ( ) {
1799
+ var cnt = document . getElementById ( "content" ) ;
1800
+ var y = cnt . getBoundingClientRect ( ) . top + 2 ;
1801
+ var c = document . elementFromPoint ( 15 , y + 1 ) ;
1799
1802
1800
- if ( $ ( c ) . is ( '.l, .hl' ) ) {
1801
- var $par = $ ( c ) . closest ( '.scope-body, .scope-head' )
1803
+ if ( $ ( c ) . is ( '.l, .hl' ) ) {
1804
+ var $par = $ ( c ) . closest ( '.scope-body, .scope-head' )
1802
1805
1803
- if ( ! $par . length ) {
1804
- return ;
1805
- }
1806
+ if ( ! $par . length ) {
1807
+ return ;
1808
+ }
1806
1809
1807
- var $head = $par . hasClass ( 'scope-body' ) ? $par . prev ( ) : $par ;
1808
- var $sig = $head . children ( ) . first ( )
1809
- if ( $ . scopesWindow . initialized ) {
1810
- $ . scopesWindow . update ( {
1811
- 'id' : $head . attr ( 'id' ) ,
1812
- 'link' : $sig . html ( ) ,
1813
- } )
1810
+ var $head = $par . hasClass ( 'scope-body' ) ? $par . prev ( ) : $par ;
1811
+ var $sig = $head . children ( ) . first ( )
1812
+ if ( $ . scopesWindow . initialized ) {
1813
+ $ . scopesWindow . update ( {
1814
+ 'id' : $head . attr ( 'id' ) ,
1815
+ 'link' : $sig . html ( ) ,
1816
+ } )
1817
+ }
1814
1818
}
1815
- }
1819
+ scope_timeout = null ;
1820
+ } , 150 ) ;
1816
1821
}
0 commit comments