mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-06 16:46:48 +01:00
Function cleanup
This commit is contained in:
@@ -1538,24 +1538,28 @@ var ICEcoder = {
|
||||
var cM, mmPosY;
|
||||
|
||||
if (ICEcoder.mouseDownMinimap) {
|
||||
// console.log(Date.now() - ICEcoder.lastScrollTS);
|
||||
cM = this.getcMInstance();
|
||||
// Set mid height position
|
||||
mmPosY = e.y - get('miniMapContainer').getBoundingClientRect().top - (get('miniMapBox').getBoundingClientRect().height / 2);
|
||||
// Unless it would be beyond bottom, if so, set to bottom
|
||||
if (mmPosY > get('miniMapContainer').getBoundingClientRect().height - get('miniMapBox').getBoundingClientRect().height) {
|
||||
// console.log("YES");
|
||||
mmPosY = get('miniMapContainer').getBoundingClientRect().height - get('miniMapBox').getBoundingClientRect().height;
|
||||
}
|
||||
// Unless it would be beyond top, if so, set to top
|
||||
if (mmPosY < 0) {
|
||||
mmPosY = 0;
|
||||
}
|
||||
get("miniMapBox").style.top = mmPosY + "px";
|
||||
maxHeight = parseInt(get('docExplorer').style.height, 10) <= parseInt(get('miniMapContainer').getBoundingClientRect().height, 10)
|
||||
// Set the max height to be that of doc explorer, or if less, the content height
|
||||
maxHeight = parseInt(get('docExplorer').style.height, 10) <= parseInt(get('miniMapContent').getBoundingClientRect().height, 10)
|
||||
? parseInt(get('docExplorer').style.height, 10)
|
||||
: parseInt(get('miniMapContainer').getBoundingClientRect().height, 10);
|
||||
: parseInt(get('miniMapContent').getBoundingClientRect().height, 10);
|
||||
// Work out the new percentag, from that yPos and set CM scroll position to that
|
||||
newPerc = (mmPosY / (maxHeight - ICEcoder.miniMapBoxHeight));
|
||||
yPos = (cM.getScrollInfo().height - cM.getScrollInfo().clientHeight) * newPerc;
|
||||
cM.scrollTo(0, yPos); // this.position.y
|
||||
}
|
||||
// If mouse buttons up, we no longer have mouse down on minimap
|
||||
if (e.buttons === 0) {
|
||||
ICEcoder.mouseDownMinimap = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user