Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
isPointInside incorrectly caches the path used to calculate its value #596
isPointInside() caches "this.realPath" var to calculate a return. This means if you modified a shapes attributes using the .attr() method (as opposed to using a transform) this meant the real path used would be wrong.
My change forces isPointInside to always re-calculate the realPath.
Looking through the code, it actually looks like realPath is only used as a local variable in a few methods - and not as a cached "global" variable. It might be worth removing it entirely - or alternatively create a fully featured global to cache the realPath correctly (ie update it every time the shapes' properties change).
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
I just ran into this issue myself. I created glow for an element. I updated it using ".attr('x', ...)". I removed the old glow and called glow again to update it. It drew the glow in the old location. And this was because of the bad cached value at "this.realPath".
This will also cause future calls to isPointInside to fail!