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

168
Vistas
Can we simulate mouse movement with TypeScript

I am actually working on a project where I need to "draw" rectangles on a PDF. This happens the same way you would select multiple files on your desktop. You hold down your click, "draw" a rectangle and once your rectangle has the size you want it to, you just release the click.

To do this, I use React-PDF-highlighter (find an example here: https://agentcooper.github.io/react-pdf-highlighter/ ---> Note that to draw said rectangle in this example, you need to be holding down option key on mac or Altkey on windows at the same time.)

For some reasons I would really like to let the user drag a square from some kind of left menu on the PDF. For the "drag and drop", I use React-dnd.

so from now on, just imagine a screen divided in 2. On the left side, you have the possibility to drag and drop a rectangle and on the right side, you have a PDF file that can contain multiple pages of course.

Problem is, when I drag and drop my square on my pdf highlighter component, I have no way to know what page I dropped my rectangle on. I do have the screen coordinates of the drop though.

Is there a way to SIMULATE a mouse mouvement? Not actually do it, I know that's impossible. But can I make the browser believe that the mouse clicked on a certain point (the coordinates of the released drop) and from there on make it believe the click has been released a bit further in diagonal to create a simple square that would be nicely added to the list?

If someone helps me out here, he or she would get my eternal gratitude!

Have a wonderful day, and all the best for 2022!!

about 4 years ago · Juan Pablo Isaza
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