Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

124
Views
Scale & translate canvas

I am scaling a canvas on a point pt

context.translate(pt.x, pt.y);
var factor = Math.pow(scaleFactor, clicks); 
//scaleFactor and clicks are the amount of zoom each scroll and the scroll value itself
context.scale(factor, factor);
context.translate(-pt.x, -pt.y);
current_scale *= factor;

It works well, but I have another canvas layer using css to scale, and I have to find the correct parameters to translate it at the same origin of the first canvas so that it's correctly on top of each other (originX and originY are the coordinates of this canvas layer).

originX += ?;
originY += ?;

context_display.putImageData(imageData, originX, originY);
$("#display").css("transform", "scale(" + current_scale + ")");

What calculation should I do to get originX and originY?

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!