简体   繁体   English

Konvajs:如何从画布对象中获取与画布坐标相对应的弓箭手坐标?

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

I am trying to automate konvajs canvas UI.我正在尝试自动化 konvajs 画布 UI。

when using tools like selenium or playwright, the click event clicks on browser co-ordinates which are different from canvas co-ordinates.当使用 selenium 或 playwright 之类的工具时, click 事件会点击不同于画布坐标的浏览器坐标。

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.因此,我需要一些 api 或代码来提供与画布坐标相对应的浏览器坐标。

Please share your valuable inputs请分享您的宝贵意见

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM