Minor code tweaks and fix minimap box position

This commit is contained in:
Matt Pass
2016-10-23 13:23:02 +01:00
parent ce1919ba64
commit e228d2a59d
2 changed files with 3 additions and 4 deletions

View File

@@ -1266,16 +1266,15 @@ var ICEcoder = {
top.ICEcoder.miniMapBoxTop = (percThru*parseInt(get('docExplorer').style.height,10)) - (percThru*top.ICEcoder.miniMapBoxHeight);
// Set the minimap position according to scroll position (used if we move cursor in document)
get('miniMapContent').style.marginTop = (-(parseInt(get('miniMapContent').getBoundingClientRect().height,10) - parseInt(get('docExplorer').style.height,10))*percThru) + "px";
//console.log(get('miniMapContent').style.marginTop);
// If less than the docExplorer height
} else {
// Set height of container to that of the content
get('miniMapContainer').style.height = parseInt(get('miniMapContent').getBoundingClientRect().height,10)+"px";
// Set box height relative to font height
top.ICEcoder.miniMapBoxHeight = parseInt(get('docExplorer').style.height,10)/cM.defaultTextHeight()*2;
top.ICEcoder.miniMapBoxHeight = (parseInt(get('docExplorer').style.height,10)/cM.defaultTextHeight()*2);
get('miniMapBox').style.height = top.ICEcoder.miniMapBoxHeight + "px";
// Set top position of it according to percentage through minimap and account for height of nav box
top.ICEcoder.miniMapBoxTop = (percThru*parseInt(get('miniMap').getBoundingClientRect().height,10)) - (percThru*top.ICEcoder.miniMapBoxHeight);
top.ICEcoder.miniMapBoxTop = (percThru*parseInt(get('miniMapContainer').getBoundingClientRect().height,10)) - (percThru*top.ICEcoder.miniMapBoxHeight);
// Set the minimap position to 0
get('miniMapContent').style.marginTop = 0;
}

View File

@@ -53,7 +53,7 @@ get("miniMapContainer").innerHTML='<div style="position: absolute; display: inli
10)?parseInt(get("docExplorer").style.height,10):parseInt(get("miniMapContent").getBoundingClientRect().height,10);newPerc=this.position.y/(maxHeight-top.ICEcoder.miniMapBoxHeight);yPos=(a.getScrollInfo().height-a.getScrollInfo().clientHeight)*newPerc;a.scrollTo(0,yPos)});b.on("pointerDown",function(a,b){top.ICEcoder.mouseDownMinimap=!0});b.on("pointerUp",function(a,b){top.ICEcoder.mouseDownMinimap=!1});top.ICEcoder.setMinimapLayout();get("docExplorer").style.right="-220px"}},setMinimapLayout:function(a,
b){var c,d;get("miniMapBox")&&a&&(c=top.ICEcoder.getcMInstance(),d=a.getScrollInfo().top/(a.getScrollInfo().height-a.getScrollInfo().clientHeight),parseInt(get("miniMapContent").getBoundingClientRect().height,10)>parseInt(get("docExplorer").style.height,10)?(get("miniMapContainer").style.height=parseInt(get("docExplorer").style.height,10)+"px",top.ICEcoder.miniMapBoxHeight=parseInt(get("docExplorer").style.height,10)/c.defaultTextHeight()*2,get("miniMapBox").style.height=top.ICEcoder.miniMapBoxHeight+
"px",top.ICEcoder.miniMapBoxTop=d*parseInt(get("docExplorer").style.height,10)-d*top.ICEcoder.miniMapBoxHeight,get("miniMapContent").style.marginTop=-(parseInt(get("miniMapContent").getBoundingClientRect().height,10)-parseInt(get("docExplorer").style.height,10))*d+"px"):(get("miniMapContainer").style.height=parseInt(get("miniMapContent").getBoundingClientRect().height,10)+"px",top.ICEcoder.miniMapBoxHeight=parseInt(get("docExplorer").style.height,10)/c.defaultTextHeight()*2,get("miniMapBox").style.height=
top.ICEcoder.miniMapBoxHeight+"px",top.ICEcoder.miniMapBoxTop=d*parseInt(get("miniMap").getBoundingClientRect().height,10)-d*top.ICEcoder.miniMapBoxHeight,get("miniMapContent").style.marginTop=0),top.ICEcoder.mouseDownMinimap||(get("miniMapBox").style.top=top.ICEcoder.miniMapBoxTop+"px"))},autocomplete:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;top.ICEcoder.content.contentWindow.CodeMirror.commands.autocomplete(a)},
top.ICEcoder.miniMapBoxHeight+"px",top.ICEcoder.miniMapBoxTop=d*parseInt(get("miniMapContainer").getBoundingClientRect().height,10)-d*top.ICEcoder.miniMapBoxHeight,get("miniMapContent").style.marginTop=0),top.ICEcoder.mouseDownMinimap||(get("miniMapBox").style.top=top.ICEcoder.miniMapBoxTop+"px"))},autocomplete:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;top.ICEcoder.content.contentWindow.CodeMirror.commands.autocomplete(a)},
pasteURL:function(a){var b,c;b=top.ICEcoder.getcMInstance();c=top.ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;"CTRL"==top.ICEcoder.draggingWithKey&&(a=window.location.protocol+"//"+window.location.hostname+a);b.replaceSelection(a,"around")},searchForSelected:function(){var a,b;a=top.ICEcoder.getcMInstance();b=top.ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;top.ICEcoder.caretLocType&&(""!=a.getSelection()?(b=top.ICEcoder.caretLocType.toLowerCase()+
" ","Content"==top.ICEcoder.caretLocType&&(b=""),window.open("http://www.google.com/#output=search&q="+b+a.getSelection())):top.ICEcoder.message(top.t["No text selected..."]))},fmAction:function(a,b){var c,d,e,f;c=top.get("filesFrame").contentWindow.document.getElementById(top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1]+"_perms").parentNode;d=c.parentNode;e=-1<c.onmouseover.toString().indexOf("'folder'")?"folder":"file";f=!1;"up"==b&&(d.previousSibling&&d.previousSibling.previousSibling?
(f=d.previousSibling.previousSibling,"UL"==f.tagName&&(f=f.childNodes[f.childNodes.length-1])):d.parentNode.previousSibling&&(f=d.parentNode.previousSibling),f&&(f=f.childNodes[0]));"down"==b&&(d.nextSibling&&d.nextSibling.childNodes[0]?f=d.nextSibling.childNodes[0]:d.nextSibling&&d.nextSibling.nextSibling?f=d.nextSibling.nextSibling:d.parentNode.nextSibling&&(f=d.parentNode.nextSibling.nextSibling),f&&(f=f.childNodes[0]));"left"==b&&"folder"==e&&d.parentNode.previousSibling&&top.ICEcoder.openCloseDir(c,