williamngan / pts

A library for visualization and creative-coding
https://ptsjs.org
Apache License 2.0
5.16k stars 182 forks source link

Fix problems with `Bound` #215

Closed suguruwataru closed 3 months ago

suguruwataru commented 4 months ago
  1. Group.toBound's return type was wrongly marked Group. Closes #214
  2. Bound stores top left and bottom right Pts separately. Close #213

For 2, top left and bottom right Pts were separate from Pts that are indexable using integers.

This causes that, when a calculation method such as add inherited from Group is used on a Bound, the Bound's corner Ptss are sometimes not updated, as Group uses integer indices for getting the member Pts.

In order to fix this, the separate members _topLeft and _bottomRight are removed from Bound. topLeft and bottomRight are now just getters for integer-indexable Pts.

netlify[bot] commented 4 months ago

Deploy Preview for astronaut-horse-32874 ready!

Name Link
Latest commit c03d89c898c7a3d25e18cf4466be552498de7fed
Latest deploy log https://app.netlify.com/sites/astronaut-horse-32874/deploys/663a768dc1f9a4000878d399
Deploy Preview https://deploy-preview-215--astronaut-horse-32874.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

williamngan commented 3 months ago

@ii41 - Thank you so much for catching this bug and providing such a great fix too. Really appreciate it!