3/25/2021, 9:17:44 PM
< Feedback on Gartic Phone Shortcuts
The script works but need some fixes:
const pattern = /\/([a-zA-Z]*)\/draw/g; if (location.pathname.match(pattern)) { // code... }
img.onload = function() { var x, y = 0; var wRatio, hRatio = 0; var width = canvas.width; var height = canvas.height; //Aspect ratio if (img.width > canvas.width || img.height > canvas.height) { wRatio = img.width / canvas.width; hRatio = img.height / canvas.height; if (wRatio > hRatio) { width = canvas.width; height = img.height / wRatio; } else { height = canvas.height; width = img.width / hRatio; } } else { width = img.width; height = img.height; } //Center x = (canvas.width - width) / 2; y = (canvas.height - height) / 2; //Draw context.drawImage(this, x, y, width, height); }
Sign in to post a reply.
The script works but need some fixes: