jonobr1 / two.js

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

Two.Arc dimensions update issue[Bug] #728

Open dickinson0718 opened 1 month ago

dickinson0718 commented 1 month ago

Describe the bug I'm trying to use a Two.Arc object (in the "extras") and to dynamically update the height and width after adding it to the scene. Binding a function to the update event that changes the rotation, height and width of the arc doesn't result in the width or height of the arc changing. The rotation does update, but I believe the height and width should also update.

To Reproduce Check out this CodePen example:

https://codepen.io/dickinson0718/pen/vYwRGgv

The rectangle and ellipse dynamically update their width, height, and rotation. The rotation of the arc dynamically updates, but not the width and height. I think the height and width update once because in the CodePen example the original arc has a width of 100 and a height of 800, but the rotating image seems to be an arc with width and height of about 200.

Expected behavior The arc should update in this same way as the rectangle and ellipse in the CodePen example.

Screenshots CodePen example shows the behavior

Environment (please select one):

Desktop (please complete the following information):

Smartphone (please complete the following information): Not checked

Additional context Thanks for building and maintaining Two.js!

dickinson0718 commented 1 month ago

I discovered a work around. If you change the start or end angle in the arc, then the height/width update. Check out this: https://codepen.io/dickinson0718/pen/dyEeqMG

jonobr1 commented 1 month ago

Good eye. I updated the extras to adjust to width and height changes. I'll publish a new version to npm in the coming days.

dickinson0718 commented 1 month ago

Thanks!