-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Merged
Merged
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9c2be8d
pass dragbox element to mouseEvent
etpinard c9711dc
fixup "role" for ax autorange and rangemode
etpinard bd61c54
sub fail -> failTest
etpinard b1911b3
run Axes.expand on `autorange: false` axes
etpinard 35d501d
handle splom Axes.expand calls w/ undefined xa/ya
etpinard a8fb653
adapt and :lock: annotations to 'calcIfAutorange'-less edits!
etpinard 6e19c6e
remove unused '_' fields in annotations full items
etpinard 4e8ff28
:lock: marker.size calc + autorange edit behavior
etpinard c75cda8
swap and :lock: 'calcIfAutorange' -> 'calc' for shapes
etpinard 8f23ef5
swap and :lock: 'calcIfAutorange' -> 'calc' for box attributes
etpinard a326778
fix and :lock: ohlc tickwidth edits
etpinard 138a84f
:hocho: calcIfAutorange logic in Plotly methods
etpinard 1c40947
try ax autorange as 'axrange' edit type
etpinard 026cd53
lint / fix comment
etpinard 1cdc36b
:hocho: obsolete _rangesliderAutorange field
etpinard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
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; | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.