Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

135
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda