@@ -260,8 +260,19 @@ var ICEcoder = {
260260
261261 // Doc Explorer show item
262262 docExplorerShow : function ( item ) {
263+ var cM ;
264+
263265 get ( 'miniMap' ) . style . display = item == "miniMap" ? 'block' : 'none' ;
264266 get ( 'functionClassList' ) . style . display = item == "functionClassList" ? 'block' : 'none' ;
267+ if ( item == "miniMap" ) {
268+ top . miniMapInt = setInterval ( function ( ) {
269+ if ( get ( 'miniMapContent' ) . getBoundingClientRect ( ) . height != 0 ) {
270+ cM = top . ICEcoder . getcMInstance ( ) ;
271+ top . ICEcoder . setMinimapLayout ( cM ) ;
272+ clearInterval ( top . miniMapInt ) ;
273+ }
274+ } , 10 ) ;
275+ }
265276 } ,
266277
267278 // Set the width of the file manager on demand
@@ -545,6 +556,10 @@ var ICEcoder = {
545556 } ,
546557
547558 cMonUpdate : function ( thisCM , cMinstance ) {
559+ // Update the minimap background to match theme
560+ setTimeout ( function ( ) {
561+ get ( 'docExplorer' ) . style . background = window . getComputedStyle ( thisCM . getWrapperElement ( ) , null ) . getPropertyValue ( 'background' ) ;
562+ } , 0 ) ;
548563 // Set the Minimap layout
549564 top . ICEcoder . setMinimapLayout ( thisCM , cMinstance ) ;
550565 } ,
@@ -920,11 +935,29 @@ var ICEcoder = {
920935 goToLine : function ( lineNo ) {
921936 var cM , cMdiff , thisCM ;
922937
938+ lineNo = lineNo ? lineNo - 1 : top . get ( 'goToLineNo' ) . value - 1 ;
939+
923940 cM = ICEcoder . getcMInstance ( ) ;
924941 cMdiff = ICEcoder . getcMdiffInstance ( ) ;
925942 thisCM = top . ICEcoder . editorFocusInstance . indexOf ( 'diff' ) > - 1 ? cMdiff : cM ;
926943
927- thisCM . setCursor ( lineNo ? lineNo - 1 : top . get ( 'goToLineNo' ) . value - 1 ) ;
944+ top . ICEcoder . scrollingOnLine = thisCM . getCursor ( ) . line ;
945+
946+ // Scroll cursor into middle of view
947+ if ( "undefined" != typeof top . ICEcoder . scrollInt ) {
948+ clearInterval ( top . ICEcoder . scrollInt ) ;
949+ }
950+
951+ top . ICEcoder . scrollInt = setInterval ( function ( ) {
952+ top . ICEcoder . scrollingOnLine = top . ICEcoder . scrollingOnLine + ( ( lineNo - top . ICEcoder . scrollingOnLine ) / 5 ) ;
953+ thisCM . scrollTo ( 0 , ( thisCM . defaultTextHeight ( ) * top . ICEcoder . scrollingOnLine ) - ( thisCM . getScrollInfo ( ) . clientHeight / 10 ) ) ;
954+ top . ICEcoder . setMinimapLayout ( thisCM ) ;
955+ if ( Math . round ( top . ICEcoder . scrollingOnLine ) == lineNo ) {
956+ clearInterval ( top . ICEcoder . scrollInt ) ;
957+ }
958+ } , 10 ) ;
959+
960+ thisCM . setCursor ( lineNo ) ;
928961 top . ICEcoder . focus ( ) ;
929962 // Also do this after a 0ms tickover incase DOM wasn't ready
930963 setTimeout ( function ( ) { top . ICEcoder . focus ( ) ; } , 0 ) ;
@@ -1138,7 +1171,7 @@ var ICEcoder = {
11381171 top . ICEcoder . functionClassList . push ( {
11391172 line : cM . getLineNumber ( handle ) ,
11401173 name : functionClassText [ 0 ] ,
1141- params : "(" + functionClassText [ 1 ] ,
1174+ params : "(" + ( functionClassText [ 1 ] ? functionClassText [ 1 ] . replace ( / [ , ] / g , ", " ) : "" ) ,
11421175 verified : false
11431176 } ) ;
11441177 // After a 0ms tickover, verify the item
@@ -1172,7 +1205,7 @@ var ICEcoder = {
11721205 get ( 'miniMapContainer' ) . innerHTML = '<div style="position: absolute; display: inline-block; top: ' +
11731206 top . ICEcoder . miniMapBoxTop +
11741207 'px; left: 0; width: 200px; height: ' +
1175- top . ICEcoder . miniMapBoxHeight + 'px; background: rgba(0,198,255,0.3 ); z-index: 100 ; cursor: pointer" id="miniMapBox"></div>' ;
1208+ top . ICEcoder . miniMapBoxHeight + 'px; background: rgba(0,198,255,0.1 ); z-index: 1 ; cursor: pointer" id="miniMapBox"></div>' ;
11761209
11771210 var elem = get ( 'miniMapBox' ) ;
11781211 var draggie = new Draggabilly ( elem , {
@@ -1195,24 +1228,29 @@ var ICEcoder = {
11951228 draggie . on ( 'pointerUp' , function ( event , pointer ) {
11961229 top . ICEcoder . mouseDownMinimap = false ;
11971230 } ) ;
1231+
1232+ top . ICEcoder . setMinimapLayout ( ) ;
1233+
1234+ get ( 'docExplorer' ) . style . right = "-220px" ;
11981235 }
11991236 } ,
12001237
12011238 setMinimapLayout : function ( thisCM , cMinstance ) {
12021239 var cM , percThru ;
12031240
1204- // Get CM instance and percentage through document
1205- cM = top . ICEcoder . getcMInstance ( ) ;
1206- percThru = thisCM . getScrollInfo ( ) . top / ( thisCM . getScrollInfo ( ) . height - thisCM . getScrollInfo ( ) . clientHeight ) ;
1207-
12081241 // If we've got a minimap box ready
1209- if ( get ( 'miniMapBox' ) ) {
1242+ if ( get ( 'miniMapBox' ) && thisCM ) {
1243+
1244+ // Get CM instance and percentage through document
1245+ cM = top . ICEcoder . getcMInstance ( ) ;
1246+ percThru = thisCM . getScrollInfo ( ) . top / ( thisCM . getScrollInfo ( ) . height - thisCM . getScrollInfo ( ) . clientHeight ) ;
1247+
12101248 // If content to display has a greater height than docExplorer
12111249 if ( parseInt ( get ( 'miniMapContent' ) . getBoundingClientRect ( ) . height , 10 ) > parseInt ( get ( 'docExplorer' ) . style . height , 10 ) ) {
12121250 // Set the minimap container to same height
12131251 get ( 'miniMapContainer' ) . style . height = parseInt ( get ( 'docExplorer' ) . style . height , 10 ) + "px" ;
12141252 // Set box height relative to font height
1215- top . ICEcoder . miniMapBoxHeight = parseInt ( get ( 'docExplorer' ) . style . height , 10 ) / cM . defaultTextHeight ( ) * 2 ;
1253+ top . ICEcoder . miniMapBoxHeight = ( parseInt ( get ( 'docExplorer' ) . style . height , 10 ) / cM . defaultTextHeight ( ) * 2 ) ;
12161254 get ( 'miniMapBox' ) . style . height = top . ICEcoder . miniMapBoxHeight + "px" ;
12171255 // Set top position of it according to percentage through document and account for height of nav box
12181256 top . ICEcoder . miniMapBoxTop = ( percThru * parseInt ( get ( 'docExplorer' ) . style . height , 10 ) ) - ( percThru * top . ICEcoder . miniMapBoxHeight ) ;
@@ -3578,6 +3616,8 @@ var ICEcoder = {
35783616 top . doMiniNav = setTimeout ( function ( ) {
35793617 top . ICEcoder . setMinimap ( ) ;
35803618 } , top . ICEcoder . loadingFile ? 0 : 100 ) ;
3619+ get ( 'docExplorer' ) . style . display = "block" ;
3620+ get ( 'docExplorer' ) . style . right = "-400px" ;
35813621
35823622 // Highlight the selected tab
35833623 ICEcoder . redoTabHighlight ( ICEcoder . selectedTab ) ;
@@ -3752,6 +3792,7 @@ var ICEcoder = {
37523792 // grey out the view icon
37533793 if ( ICEcoder . openFiles . length == 0 ) {
37543794 top . ICEcoder . fMIconVis ( 'fMView' , 0.3 ) ;
3795+ get ( 'docExplorer' ) . style . display = "none" ;
37553796 } else {
37563797 // Switch the mode & the tab
37573798 ICEcoder . switchMode ( ) ;
0 commit comments