mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-11 10:22:13 +00:00
mass ports like 15 tg prs + counting (#13386)
* changes * ok * changes * sigh * fixes * changes * fix * fix * alright * fixes git pus * fix * fix * fix * test * ok * Update code/modules/paperwork/ticketmachine.dm Co-authored-by: Letter N <24603524+LetterN@users.noreply.github.com> * ok * compile and other stuff * ok * fix * fix * Fix * Update menu.dm * Update view.dm * Update preferences.dm Co-authored-by: Letter N <24603524+LetterN@users.noreply.github.com> Co-authored-by: Putnam3145 <putnam3145@gmail.com>
This commit is contained in:
@@ -120,12 +120,17 @@
|
||||
window.location = 'byond://winset?id='+tooltip.control+';anchor1=0,0;size=999x999';
|
||||
|
||||
//Get the real icon size according to the client view
|
||||
//FYI, this bit is even more borrowed from goon, our widescreen broke tooltips so I took a look at how they do it
|
||||
//To improve our code. Thanks gooncoders, very cool
|
||||
var mapWidth = map['view-size'].x,
|
||||
mapHeight = map['view-size'].y,
|
||||
tilesShown = tooltip.client_view_h
|
||||
realIconSize = mapHeight / tilesShown,
|
||||
resizeRatio = realIconSize / tooltip.tileSize,
|
||||
//Calculate letterboxing offsets
|
||||
tilesShownX = tooltip.client_view_w
|
||||
tilesShownY = tooltip.client_view_h
|
||||
realIconSizeX = mapWidth / tilesShownX,
|
||||
realIconSizeY = mapHeight / tilesShownY,
|
||||
resizeRatioX = realIconSizeX / tooltip.tileSize,
|
||||
resizeRatioY = realIconSizeY / tooltip.tileSize,
|
||||
//Calculate letterboxing offsets
|
||||
leftOffset = (map.size.x - mapWidth) / 2,
|
||||
topOffset = (map.size.y - mapHeight) / 2;
|
||||
|
||||
@@ -168,7 +173,7 @@
|
||||
if ((iconX + westOffset) !== enteredX) { //Cursor entered on the offset tile
|
||||
left = left + (westOffset < 0 ? 1 : -1);
|
||||
}
|
||||
leftOffset = leftOffset + (westOffset * resizeRatio);
|
||||
leftOffset = leftOffset + (westOffset * resizeRatioX);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,13 +184,13 @@
|
||||
if (northOffset !== 0) {
|
||||
if ((iconY + northOffset) === enteredY) { //Cursor entered on the original tile
|
||||
top--;
|
||||
topOffset = topOffset - ((tooltip.tileSize + northOffset) * resizeRatio);
|
||||
topOffset = topOffset - ((tooltip.tileSize + northOffset) * resizeRatioY);
|
||||
} else { //Cursor entered on the offset tile
|
||||
if (northOffset < 0) { //Offset southwards
|
||||
topOffset = topOffset - ((tooltip.tileSize + northOffset) * resizeRatio);
|
||||
topOffset = topOffset - ((tooltip.tileSize + northOffset) * resizeRatioY);
|
||||
} else { //Offset northwards
|
||||
top--;
|
||||
topOffset = topOffset - (northOffset * resizeRatio);
|
||||
topOffset = topOffset - (northOffset * resizeRatioY);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -198,12 +203,12 @@
|
||||
}
|
||||
|
||||
//Clamp values
|
||||
left = (left < 0 ? 0 : (left > tilesShown ? tilesShown : left));
|
||||
top = (top < 0 ? 0 : (top > tilesShown ? tilesShown : top));
|
||||
left = (left < 0 ? 0 : (left > tilesShownX ? tilesShownX : left));
|
||||
top = (top < 0 ? 0 : (top > tilesShownY ? tilesShownY : top));
|
||||
|
||||
//Calculate where on the screen the popup should appear (below the hovered tile)
|
||||
var posX = Math.round(((left - 1) * realIconSize) + leftOffset + tooltip.padding); //-1 to position at the left of the target tile
|
||||
var posY = Math.round(((tilesShown - top + 1) * realIconSize) + topOffset + tooltip.padding); //+1 to position at the bottom of the target tile
|
||||
var posX = Math.round(((left - 1) * realIconSizeX) + leftOffset + tooltip.padding); //-1 to position at the left of the target tile
|
||||
var posY = Math.round(((tilesShownY - top + 1) * realIconSizeY) + topOffset + tooltip.padding); //+1 to position at the bottom of the target tile
|
||||
|
||||
//alert(mapWidth+' | '+mapHeight+' | '+tilesShown+' | '+realIconSize+' | '+leftOffset+' | '+topOffset+' | '+left+' | '+top+' | '+posX+' | '+posY); //DEBUG
|
||||
|
||||
@@ -221,7 +226,7 @@
|
||||
docHeight = $wrap.outerHeight();
|
||||
|
||||
if (posY + docHeight > map.size.y) { //Is the bottom edge below the window? Snap it up if so
|
||||
posY = (posY - docHeight) - realIconSize - tooltip.padding;
|
||||
posY = (posY - docHeight) - realIconSizeY - tooltip.padding;
|
||||
}
|
||||
|
||||
//Actually size, move and show the tooltip box
|
||||
|
||||
Reference in New Issue
Block a user