New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bound's bottom right pt isn't updated after calling e.g. add
#213
Comments
ii41
added a commit
to ii41/pts
that referenced
this issue
May 7, 2024
…illiamngan#214 2. `Bound` stores top left and bottom right `Pt`s separately. Close williamngan#213 For 2, top left and bottom right `Pt`s were separate from `Pt`s 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 `Pts`s are sometimes not updated, as `Group` uses integer indices for getting the member `Pt`s. 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 `Pt`s.
ii41
added a commit
to ii41/pts
that referenced
this issue
May 7, 2024
1. `Group.toBound`'s return type was wrongly marked `Group`. Closes williamngan#214 2. `Bound` stores top left and bottom right `Pt`s separately. Close williamngan#213 For 2, top left and bottom right `Pt`s were separate from `Pt`s 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 `Pts`s are sometimes not updated, as `Group` uses integer indices for getting the member `Pt`s. 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 `Pt`s.
Merged
williamngan
pushed a commit
that referenced
this issue
May 19, 2024
1. `Group.toBound`'s return type was wrongly marked `Group`. Closes #214 2. `Bound` stores top left and bottom right `Pt`s separately. Close #213 For 2, top left and bottom right `Pt`s were separate from `Pt`s 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 `Pts`s are sometimes not updated, as `Group` uses integer indices for getting the member `Pt`s. 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 `Pt`s.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One would expect
p
to bePt(2, 2)
, but it's actuallyPt(1, 1)
.I suspect that this is because unlike the top left point, the bottom right point is not initialized using the setter, but uses an direct assignment to the member variable, so it's not one of the points that are indexable using numbers (setters make the points indexable from 0 and 1). Methods such as
add
are inherited fromGroup
, and they rely on integer indexing to get points.I'm using 0.11.3, but this appears to also exist in master.
pts/src/Pt.ts
Lines 1021 to 1022 in 47de4b7
For anyone else who is facing this issue and don't want to wait for a fix to land, there's an
update
method onBound
that updates the point.The text was updated successfully, but these errors were encountered: