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
Lasso & rectangular selections#154
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
d6f983ee536a915cad4ffca60e6376926d778d2867f0e6cfbc0a94f712b43c607e5cefb1a1c2419584753c40c41188a0db8d0afb51c5f325d0203c85be72de057e4ac556cb837b07a252a970fcd7abd187addcecd02d612698376e89c1655d8ed7a77d897a496e01b6bc04a15710791d342f991b5c090f1d7745fFile 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 |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| dist | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -10,6 +10,7 @@ | ||
| 'use strict'; | ||
| var Plotly = require('../../plotly'); | ||
| var scatterSubTypes = require('../../traces/scatter/subtypes'); | ||
| var createModeBar = require('./'); | ||
| var modeBarButtons = require('./buttons'); | ||
| @@ -57,7 +58,7 @@ module.exports = function manageModeBar(gd) { | ||
| } | ||
| else { | ||
| buttonGroups = getButtonGroups( | ||
| fullLayout, | ||
| gd, | ||
| context.modeBarButtonsToRemove, | ||
| context.modeBarButtonsToAdd | ||
| ); | ||
| @@ -68,8 +69,12 @@ module.exports = function manageModeBar(gd) { | ||
| }; | ||
| // logic behind which buttons are displayed by default | ||
| function getButtonGroups(fullLayout, buttonsToRemove, buttonsToAdd) { | ||
| var groups = []; | ||
| function getButtonGroups(gd, buttonsToRemove, buttonsToAdd) { | ||
| var fullLayout = gd._fullLayout, | ||
| fullData = gd._fullData, | ||
| groups = [], | ||
| i, | ||
| trace; | ||
| function addGroup(newGroup) { | ||
| var out = []; | ||
| @@ -99,10 +104,40 @@ function getButtonGroups(fullLayout, buttonsToRemove, buttonsToAdd) { | ||
| var hasCartesian = fullLayout._hasCartesian, | ||
| hasGL2D = fullLayout._hasGL2D, | ||
| allAxesFixed = areAllAxesFixed(fullLayout); | ||
| allAxesFixed = areAllAxesFixed(fullLayout), | ||
| dragModeGroup = []; | ||
| if((hasCartesian || hasGL2D) && !allAxesFixed) { | ||
| dragModeGroup = ['zoom2d', 'pan2d']; | ||
| } | ||
| if(hasCartesian) { | ||
| // look for traces that support selection | ||
| // to be updated as we add more selectPoints handlers | ||
| var selectable = false; | ||
| for(i = 0; i < fullData.length; i++) { | ||
| if(selectable) break; | ||
| trace = fullData[i]; | ||
| if(!trace._module || !trace._module.selectPoints) continue; | ||
| if(trace.type === 'scatter') { | ||
| if(scatterSubTypes.hasMarkers(trace) || scatterSubTypes.hasText(trace)) { | ||
| selectable = true; | ||
| } | ||
| } | ||
| // assume that in general if the trace module has selectPoints, | ||
| // then it's selectable. Scatter is an exception to this because it must | ||
| // have markers or text, not just be a scatter type. | ||
| else selectable = true; | ||
| } | ||
| if(selectable) { | ||
| dragModeGroup.push('select2d'); | ||
| dragModeGroup.push('lasso2d'); | ||
| } | ||
| } | ||
| if(dragModeGroup.length) addGroup(dragModeGroup); | ||
| if((hasCartesian || hasGL2D) && !allAxesFixed) { | ||
| addGroup(['zoom2d', 'pan2d']); | ||
| addGroup(['zoomIn2d', 'zoomOut2d', 'autoScale2d', 'resetScale2d']); | ||
| } | ||
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. this if statement could be moved up here, right? Contributor 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. @cpsievert that would change the order which the buttons are displayed | ||
| @@ -119,7 +154,7 @@ function getButtonGroups(fullLayout, buttonsToRemove, buttonsToAdd) { | ||
| // append buttonsToAdd to the groups | ||
| if(buttonsToAdd.length) { | ||
| if(Array.isArray(buttonsToAdd[0])) { | ||
| for(var i = 0; i < buttonsToAdd.length; i++) { | ||
| for(i = 0; i < buttonsToAdd.length; i++) { | ||
| groups.push(buttonsToAdd[i]); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| .select-outline { | ||
| fill: none; | ||
| stroke-width: 1; | ||
| shape-rendering: crispEdges; | ||
| } | ||
| .select-outline-1 { | ||
| stroke: white; | ||
| } | ||
| .select-outline-2 { | ||
| stroke: black; | ||
| stroke-dasharray: 2px 2px; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -6,5 +6,6 @@ | ||
| @import "cursor.scss"; | ||
| @import "modebar.scss"; | ||
| @import "tooltip.scss"; | ||
| @import "drag.scss"; | ||
| } | ||
| @import "notifier.scss"; | ||
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.
@alexcjohnson your
ackdays are over? Can I ask why?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.
I think ack disappeared from my system in an OS upgrade or something... and I tried
agafter remembering I think @theengineear mentioned it a while back. I was never really bothered byackbutagdoes seem to live up to its claim of speed. Otherwise it seems pretty similar but I'm pretty basic in how I use these tools.