Konvajs : how to get bowser co-ordinates corresponding to canvas co-ordinates from canvas object?

162 views Asked by At

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

There are 1 answers

1
minatoaqua On
windowToCanvas(y) {
    return { y: y - 50 }
}

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