Просмотр исходного кода

Revert a breakage that slipped in.

I forgot to undo some changes to the drawImage logic oops
master
Fen Dweller 4 лет назад
Родитель
Сommit
9091812374
1 измененных файлов: 7 добавлений и 14 удалений
  1. +7
    -14
      macrovision.js

+ 7
- 14
macrovision.js Просмотреть файл

@@ -2051,13 +2051,6 @@ function rotate(point, angle) {
const testCtx = testCanvas.getContext("2d"); const testCtx = testCanvas.getContext("2d");
function testClick(event) { 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(); testCtx.save();


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


// Get click coordinates // Get click coordinates


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

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


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


testCtx.resetTransform(); testCtx.resetTransform();




testCtx.translate(actualW/2, actualH/2); testCtx.translate(actualW/2, actualH/2);
testCtx.rotate(angle); testCtx.rotate(angle);
testCtx.translate(-actualW/2, -actualH/2); 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.fillStyle = "red";
testCtx.fillRect(actualW/2,actualH/2,10,10); testCtx.fillRect(actualW/2,actualH/2,10,10);




Загрузка…
Отмена
Сохранить