mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-19 15:33:12 +09:00
remoteMap mouse selection overlay
This commit is contained in:
1 parent
7f6f1d07d7
commit
4b286f7b08
3 files changed
+66
-47
No files matched your search
@@ -7,3 +7,18 @@ export function getParameterByName(name, url) {
|
||||
if(!results[2]) return '';
|
||||
return decodeURIComponent(results[2].replace(/\+/g, " "));
|
||||
}
|
||||
|
||||
// ctx, entityImages[name].img, xPos, yPos, size.x, size.y, rotation, sprWidth, sprHeight, offLeft, offTop
|
||||
export function drawImageWithRotation(ctx, image, x, y, w, h, degrees, sprWidth, sprHeight, offLeft, offTop){
|
||||
ctx.save();
|
||||
ctx.translate(x+w/2, y+h/2);
|
||||
ctx.rotate(degrees*Math.PI/180.0);
|
||||
ctx.translate(-x-w/2, -y-h/2);
|
||||
if(sprWidth != undefined && sprHeight != undefined && offLeft != undefined && offTop != undefined){
|
||||
// console.log(sprWidth+" "+sprHeight+" "+offLeft+" "+offTop+" "+w+" "+h)
|
||||
ctx.drawImage(image, offLeft, offTop, sprWidth, sprHeight, x, y, w, h);
|
||||
} else {
|
||||
ctx.drawImage(image, x, y, w, h);
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
Reference in new issue
Block a user