0

I am trying to automate konvajs canvas UI.

when using tools like selenium or playwright, the click event clicks on browser co-ordinates which are different from canvas co-ordinates.

I wish to click on canvas co-ordinates. Therefore, I need some api or code which gives browser co-ordinates corresponding to canvas co-ordinates.

Please share your valuable inputs

1 Answers1

0
windowToCanvas(y) {
    return { y: y - 50 }
}

y is e.clientY, 50 is stage.y.

cottontail
  • 10,268
  • 18
  • 50
  • 51
  • 2
    Kindly add a line or two to explain what you are doing. This will help the readers to understand the answer more clearly. – Abhyuday Vaish Jun 01 '22 at 05:22