flekschas/piling.js

Pile labels are not properly reset on depile

Closed this issue · 4 comments

The pile labels are never reset upon depiling. Also, somehow the border isn't drawn anymore.

Apr-01-2020 22-27-06

I got confused about this issue...

I piled up teapot0 and teapot8, and depiled it. And I logged out (labels, pileId) in both setPileLabel() in library.js and drawLabel() in pile.js.

The log info from library.js is correct, so teapot0 should be called drawLabel(), but the log info from pile.js are all about teapot8, which means teapot0 is never called...

截屏2020-04-02 下午2 16 33

I don't know why this happens 😰

I don't know either but the easiest way to find out is to trace the call path from updated() to where pile.drawLabel() in setPileLabel(). It appears as if teapot8 is drawn twice. Somewhere along this call path teapot0 must get "lost" and the label is drawn twice for teapot8.

I found the issue 🤦🏻‍♀️It's because we didn't set isPositioning correctly, only when isPositioning is false can we draw labels.

Awesome thanks! 🎉