Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2k
Faster axis autorange + remove calcIfAutorange edit type#2823
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
9c2be8dc9711dcbd61c54b1911b335d501da8fb6536e19c6e4e8ff28c75cda88f23ef5a326778138a84f1c40947026cd531cdc36bFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -250,11 +250,6 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { | ||
| var outerWidth = Math.round(annWidth + 2 * borderfull); | ||
| var outerHeight = Math.round(annHeight + 2 * borderfull); | ||
| // save size in the annotation object for use by autoscale | ||
| options._w = annWidth; | ||
| options._h = annHeight; | ||
Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch, great to see all the pruning you manage to do in this PR! | ||
| function shiftFraction(v, anchor) { | ||
| if(anchor === 'auto') { | ||
| if(v < 1 / 3) anchor = 'left'; | ||
| @@ -300,25 +295,17 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { | ||
| * otherwise the text anchor point | ||
| */ | ||
| if(ax) { | ||
| /* | ||
| * hide the annotation if it's pointing outside the visible plot | ||
| * as long as the axis isn't autoranged - then we need to draw it | ||
| * anyway to get its bounding box. When we're dragging, an axis can | ||
| * still look autoranged even though it won't be when the drag finishes. | ||
| */ | ||
| // check if annotation is off screen, to bypass DOM manipulations | ||
| var posFraction = ax.r2fraction(options[axLetter]); | ||
| if((gd._dragging || !ax.autorange) && (posFraction < 0 || posFraction > 1)) { | ||
| if(posFraction < 0 || posFraction > 1) { | ||
| if(tailRef === axRef) { | ||
| posFraction = ax.r2fraction(options['a' + axLetter]); | ||
| if(posFraction < 0 || posFraction > 1) { | ||
| annotationIsOffscreen = true; | ||
| } | ||
| } | ||
| else { | ||
| } else { | ||
| annotationIsOffscreen = true; | ||
| } | ||
| if(annotationIsOffscreen) continue; | ||
| } | ||
| basePx = ax._offset + ax.r2p(options[axLetter]); | ||
| autoAlignFraction = 0.5; | ||
| @@ -402,7 +389,9 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { | ||
| options['_' + axLetter + 'shift'] = textShift; | ||
| } | ||
| if(annotationIsOffscreen) { | ||
| // We have everything we need for calcAutorange at this point, | ||
| // we can safely exit - unless we're currently dragging the plot | ||
| if(!gd._dragging && annotationIsOffscreen) { | ||
| annTextGroupInner.remove(); | ||
| return; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
Not for now of course, but annotations (showing, hiding, dragging in GUI) are a great argument in favor of each trace and item tracking its own autorange contributions, so it doesn't take a full recalc to move one annotation.
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.
Absolutely! I'll open an issue about this once this PR is merged.