Browse Source

Revert a breakage that slipped in.

I forgot to undo some changes to the drawImage logic oops
master
Fen Dweller 3 years ago
parent
commit
9091812374
1 changed files with 7 additions and 14 deletions
  1. +7
    -14
      macrovision.js

+ 7
- 14
macrovision.js View File

@@ -2051,13 +2051,6 @@ function rotate(point, angle) {
const testCtx = testCanvas.getContext("2d");
function testClick(event) {

// TODO: Find a way to do this correctly.
// if (navigator.userAgent.indexOf("Safari") >= 0) {
// clickDown(event.target.parentElement, event.clientX, event.clientY);
// return;
// }

testCtx.save();

const target = event.target;
@@ -2067,11 +2060,10 @@ function testClick(event) {

// Get click coordinates

let w = target.clientWidth;
let h = target.clientHeight;

let w = target.width;
let h = target.height;
let ratioW = 1, ratioH = 1;
/*
// Limit the size of the canvas so that very large images don't cause problems)
if (w > 1000) {
ratioW = w / 1000;
@@ -2083,7 +2075,7 @@ function testClick(event) {
w /= ratioH;
h /= ratioH;
}
*/
// todo remove some of this unused stuff

const ratio = ratioW * ratioH;
@@ -2114,11 +2106,12 @@ function testClick(event) {

testCtx.resetTransform();



testCtx.translate(actualW/2, actualH/2);
testCtx.rotate(angle);
testCtx.translate(-actualW/2, -actualH/2);
console.log(w, h, actualW, actualH, ratio)
testCtx.drawImage(target, 0, 0, 50, 50);
testCtx.drawImage(target, (actualW/2 - w/2), (actualH/2 - h/2), w, h);
testCtx.fillStyle = "red";
testCtx.fillRect(actualW/2,actualH/2,10,10);



Loading…
Cancel
Save