-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Bug fix - do not drop previous constraint on click #4089
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
Conversation
src/traces/parcoords/axisbrush.js
Outdated
s.brushStartCallback(); | ||
} | ||
|
||
var dragging = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. Using a module-scope variable will lead to bugs on graphs with multiple parcoords
traces (once #3361 is fixed 😏 )
Can you stash dragging
on d
on some other object that gets passed around here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/traces/parcoords/axisbrush.js
Outdated
} | ||
|
||
function dragend(lThis, d) { | ||
if(!dragging) { // i.e. click |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found it! Is this the only "new" piece of logic?
Moving the mousemove, drag start/end handler out of attachDragBehavior
made this diff was a little hard to read. For next time. having 1 commit that splits attachDragBehavior
and then 1 commit that fixes the bug would have been much appreciated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's the only new logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... to add to my "for next time" comment, if splitting work into two commits ends up being too tedious, you can alternatively leave it as one commit and highlight the "new" logic using a Github comment on the PR.
mouseClick(295, 200); | ||
delay(snapDelay)() | ||
.then(function() { | ||
expect(gd._fullData[0].dimensions[1].constraintrange).toBeCloseToArray([[0.75, 2.25], [2.75, 3.25]]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice test.
Before this patch gd._fullData[0].dimensions[1].constraintrange
evaluated to [2.75, 3.25]
💃 💃 |
Addressing https://github.com/plotly/phoenix-integration/issues/235
The bug was related to dropping the previous constraints on clicking new point to add to the list.
Noting that in that scenario the
mousemove
&drag
functions were not called; this behaviour is fixed by calling them fromdragend
function.Codepen before
Codepen after
@plotly/plotly_js