jonobr1 / two.js

A renderer agnostic two-dimensional drawing api for the web.
https://two.js.org
MIT License
8.29k stars 454 forks source link

Differences in this.two.scene.getBoundingClientRect() #610

Closed rugarve closed 2 years ago

rugarve commented 2 years ago

I make an editor map of routes and find differences in this.two.scene.getBoundingClientRect().

With scale in 0.5, i make an two.Point outside of scene and add to scene. In the moment to draw an second two.Point the this.two.scene.getBoundingClientRect() is similar of previous moment to draw first point but the escene is different. I use this for coordinate calculate.

However if repeat the same operation but now add two.anchor and path to scene for draw lines. In the first anchor for first vertice the this.two.scene.getBoundingClientRect() is similar run but the socond point for second vertice not fount similar. in this moment, this.two.scene.getBoundingClientRect() fits scene and broke my coordenate calculate.

How can solve this?

Regards

jonobr1 commented 2 years ago

Thanks for posting your question. Unfortunately, I don't totally understand. If possible, it would be great to have a CodePen or other snippet of code that runs where I could help troubleshoot.

rugarve commented 2 years ago

I solved this problem. The answer i have find are in the matrix. I need ajust with translation X e Y. Thanks

jonobr1 commented 2 years ago

Glad you were able to resolve your issue. If possible, it would be still great to share a code example so that anyone else that sees that can benefit from your troubleshooting. Thanks!