-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Scattergl lasso #1657
Merged
Merged
Scattergl lasso #1657
Changes from 21 commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
8fe669b
Update gl3d camera
dy c1a4c0c
Add dep
dy 08f0738
Merge branch 'master' of github.com:plotly/plotly.js
dy 97b827e
Add scattergl box/lasso icons
dy 3d0b325
Fix status
dy e7e4843
Make rezooming work
dy 6c29193
Get closer to creating scatter for selection
dy 6d4f9a5
Fix progress
dy cf73fbe
Fix intermediate progress
dy d3427c0
first working thing
etpinard 190d3c7
Add proper points limits
dy 9921fb9
Add scattergl selection
dy 4bff013
Fix MVP implementation
dy ab07db3
Fix proper points filtering
dy 1a3ce6d
Add selection to scattergl-fancy
dy eb4654d
Make fancy scatter properly select points
dy 920127d
Lintify
dy fb84a06
Resurrect hoveron
dy 82c71eb
Normalize selected zoom behaviour
dy 7085146
Fix losing trace reference
dy 6de41e6
Merge branch 'master' into scattergl-lasso
dy 86d7d65
Fix fancy scatter
dy d21176b
Capitalize cartesian
dy 8a1c8b8
Recycle cartesian drawFramework
dy 82610d1
Remove cartesian remnants
dy 74028eb
Rename glTrace
dy e1da55b
Remove extra check
dy 4c0d822
Lintify
dy 5d35300
Resurrect gl hover
dy 7a952b1
Outline the way to implement camera-based selection
dy b3bc7cb
Get back cartesian hover mode
dy c293529
Lintify
dy 4e6bff1
comment out mouseContainer removal in scene2d toImage
etpinard 5d07d99
Fix selection state
dy 6fb7c57
Rearrange scatter run
dy 3cb6ab1
Reduce calc time
dy b0f0ed3
Reduce calc time more
dy a74b301
Remove arrays to calcdata
dy 73ab98d
Clean up
dy 8b8d2e3
Use proper gl-scatter2d dep
dy 1451802
bring back scene2d mouseContainer + add updateFx to toggle dragmode
etpinard de115d3
do not try to recurse into gl-vis object in Lib.minExtend
etpinard 3a30ae1
don't try to remove selection elements when zoomlayer does not exist
etpinard 1c61a47
fixup 'scatter' -> addTraces 'scattergl' test
etpinard 9f57eff
Ignore overcalculating snap-points
dy c60fb1d
bring back scattergl marker colorscale
etpinard 3921fdd
:hocho: hoveron in scattergl
etpinard 07b4c7c
Fix scatter-fancy lasso
dy 6ac722d
fill scattergl calcdata only when dragmode is set to select/lasso
etpinard 2ceede1
don't try to style plot bg in gl2d case
etpinard 33dda89
don't try to style grid lines either
etpinard baabafe
don't draw cartesian framework on top of gl2d subplots in staticPlot
etpinard 0b7a924
fixup gl2d dramode logic (:lock: it with tests)
etpinard d76d64d
call updateFx on doModeBar restyle calls
etpinard 58b3654
rm useless PR diffs
etpinard bbda3e7
Merge branch 'master' into scattergl-lasso
etpinard 6bfbd83
Ignore resnapping for scatter-fancy
dy 6c08dc3
Lintify
dy 1e4e25d
Merge branch 'master' into scattergl-lasso
etpinard b92059a
add isDimmed option to fillColor util
etpinard d4aad3f
add gl2d select/lasso tests
etpinard c7b551c
try adding delay after first Plotly.plot before gl2d select/lasso tests
etpinard 27811d6
bump gl-scatter2d-sdf to ^1.3.11
etpinard ab30f93
Merge branch 'master' into scattergl-lasso
etpinard debdd46
swap 'id' for 'pointNumber' in scattergl selection data
etpinard 9d5d411
skip gl2d lasso/select for now
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 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 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 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 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 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 |
---|---|---|
|
@@ -79,7 +79,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { | |
var yIDs = [ya0._id]; | ||
|
||
// if we're dragging two axes at once, also drag overlays | ||
subplots = [plotinfo].concat((ns && ew) ? plotinfo.overlays : []); | ||
subplots = [plotinfo].concat((ns && ew && plotinfo.overlays) ? plotinfo.overlays : []); | ||
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. Why do we need the extra |
||
|
||
for(var i = 1; i < subplots.length; i++) { | ||
var subplotXa = subplots[i].xaxis, | ||
|
@@ -170,7 +170,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { | |
} | ||
} | ||
}; | ||
|
||
dragElement.init(dragOptions); | ||
|
||
var x0, | ||
|
@@ -387,7 +386,9 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { | |
var axRange = Lib.simpleMap(ax.range, ax.r2l), | ||
v0 = axRange[0] + (axRange[1] - axRange[0]) * centerFraction; | ||
function doZoom(v) { return ax.l2r(v0 + (v - v0) * zoom); } | ||
|
||
ax.range = axRange.map(doZoom); | ||
|
||
} | ||
|
||
if(ew || isSubplotConstrained) { | ||
|
@@ -443,7 +444,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { | |
} | ||
|
||
recomputeAxisLists(); | ||
|
||
if(xActive === 'ew' || yActive === 'ns') { | ||
if(xActive) dragAxList(xa, dx); | ||
if(yActive) dragAxList(ya, dy); | ||
|
@@ -504,6 +504,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { | |
// scale the other axis the same about its middle | ||
for(i = 0; i < xa.length; i++) { | ||
xa[i].range = xa[i]._r.slice(); | ||
|
||
scaleZoom(xa[i], 1 - dy / ph); | ||
} | ||
dx = dy * pw / ph; | ||
|
@@ -512,6 +513,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { | |
if(!yActive && xActive.length === 1) { | ||
for(i = 0; i < ya.length; i++) { | ||
ya[i].range = ya[i]._r.slice(); | ||
|
||
scaleZoom(ya[i], 1 - dx / pw); | ||
} | ||
dy = dx * ph / pw; | ||
|
@@ -631,7 +633,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { | |
} | ||
} | ||
} | ||
|
||
gd.emit('plotly_doubleclick', null); | ||
Plotly.relayout(gd, attrs); | ||
} | ||
|
@@ -654,6 +655,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { | |
if(axi._r[1] !== axi.range[1]) attrs[axi._name + '.range[1]'] = axi.range[1]; | ||
|
||
axi.range = axi._input.range = axi._r.slice(); | ||
|
||
} | ||
|
||
updateSubplots([0, 0, pw, ph]); | ||
|
@@ -690,7 +692,9 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { | |
|
||
function scaleAndGetShift(ax, scaleFactor) { | ||
if(scaleFactor) { | ||
|
||
ax.range = ax._r.slice(); | ||
|
||
scaleZoom(ax, scaleFactor); | ||
return ax._length * (1 - scaleFactor) / 2; | ||
} | ||
|
@@ -811,10 +815,12 @@ function zoomAxRanges(axList, r0Fraction, r1Fraction, linkedAxes) { | |
|
||
axRangeLinear0 = axi._rl[0]; | ||
axRangeLinearSpan = axi._rl[1] - axRangeLinear0; | ||
|
||
axi.range = [ | ||
axi.l2r(axRangeLinear0 + axRangeLinearSpan * r0Fraction), | ||
axi.l2r(axRangeLinear0 + axRangeLinearSpan * r1Fraction) | ||
]; | ||
|
||
} | ||
|
||
// zoom linked axes about their centers | ||
|
@@ -829,6 +835,7 @@ function dragAxList(axList, pix) { | |
for(var i = 0; i < axList.length; i++) { | ||
var axi = axList[i]; | ||
if(!axi.fixedrange) { | ||
|
||
axi.range = [ | ||
axi.l2r(axi._rl[0] - pix / axi._m), | ||
axi.l2r(axi._rl[1] - pix / axi._m) | ||
|
This file contains 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 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 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
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.
This is an interesting patch. I wonder if this might be fixing an undiscovered bugs(s).
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.
That is taken from https://github.com/dfcreative/plotly.js/blob/6de41e6d555d038299aa0aef7e075804f011db49/src/plots/cartesian/axes.js#L1657, just optimized it a drop