Skip to content

catch up #2

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 106 commits into from
Sep 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
74f9f39
bump browserify version
etpinard Apr 11, 2017
3485c0e
add compress_attributes.js transform to "browserify" field
etpinard Apr 11, 2017
2fbaaaa
Tracer-bullet impl of fast click-to-select [1852]
rmoestl Aug 10, 2018
346bad9
Set correct blank outlines path in case of zero select polygons [1852]
rmoestl Aug 16, 2018
4f8dd92
Fix select_test.js Jasmine tests [1852]
rmoestl Aug 16, 2018
6a87769
Add click-to-select specific tests to select_test.js [1852]
rmoestl Aug 17, 2018
2d59365
Make click-to-select work in pan/zoom dragmodes [1852]
rmoestl Aug 21, 2018
5a13573
Introduce layout attribute 'clickmode' [1852]
rmoestl Aug 21, 2018
d3b4a0f
Simplify signature of selection testers' contains function [1852]
rmoestl Aug 21, 2018
36145df
Support click-to-select for histograms [1852]
rmoestl Aug 22, 2018
73e5085
Fix click-to-select bug when clearing selection with Shift [1852]
rmoestl Aug 22, 2018
1a89040
Enable click-to-select for scattergl in pan/zoom mode [1852]
rmoestl Aug 22, 2018
a6e49fd
Add click-to-select support to box plots [1852]
rmoestl Aug 22, 2018
bb44b6d
Fix bug when clearing selections and add/subtract mode on [1852]
rmoestl Aug 23, 2018
48a0a36
Test violin trace type's support for click-to-test [1852]
rmoestl Aug 23, 2018
4639718
Add click-to-select support to ohlc and candlestick [1852]
rmoestl Aug 23, 2018
497747b
Add click-to-select support to geo base plot [1852]
rmoestl Aug 23, 2018
744ab56
Add click-to-select support to mapbox and scattermapbox [1852]
rmoestl Aug 24, 2018
7da973b
Add @flaky flag to click-to-select tests [1852]
rmoestl Aug 24, 2018
ee5f990
Reactivate unhover on mouseout event in geo base plot [1852]
rmoestl Aug 24, 2018
6ac1a08
Add click-to-select support to scattergeo [1852]
rmoestl Aug 24, 2018
e11faf5
Add click-to-select support to ternary base plot [1852]
rmoestl Aug 24, 2018
bef47a3
Add test of scattercarpet's click-to-select support [1852]
rmoestl Aug 24, 2018
c394a8b
Add click-to-select support to polar base plot [1852]
rmoestl Aug 24, 2018
5b08a2c
Add testing scatterpolargl's click-to-select support [1852]
rmoestl Aug 24, 2018
e763964
Add click-to-select support to splom [1852]
rmoestl Aug 24, 2018
41e3ba5
Activate persistent selection for ternary plots [1852]
rmoestl Aug 27, 2018
6a2ae3b
Refine click-to-select TODO comments that'll be solved later [1852]
rmoestl Aug 27, 2018
e7c2240
Clean up box' custom eventData function [1852]
rmoestl Aug 27, 2018
23024b2
Call click-to-select's isPointOrBinSelected as late as possible [1852]
rmoestl Aug 27, 2018
cbd9f07
Refactor selection testing namings and structure [1852]
rmoestl Aug 27, 2018
7eba640
Add comment for multiTester's contains function [1852]
rmoestl Aug 27, 2018
92ee0fa
Remove two obsolete comments from cartesian/select.js [1852]
rmoestl Aug 27, 2018
3073f61
Merge branch 'master' into 1852-persistent-click-via-selectPoints
rmoestl Aug 27, 2018
3767ce2
Fix test-syntax linting errors in select_test.js [1852]
rmoestl Aug 27, 2018
8a4fc99
Fix further test-syntax linting errors in select_test.js [1852]
rmoestl Aug 27, 2018
db3e126
Fix for-loop bug in cartesian/select.js caught by ESLint [1852]
rmoestl Aug 27, 2018
b3984f7
Adapt description of of `clickmode` attribute [1852]
rmoestl Aug 29, 2018
2f7ad27
Simplify check if clicked point is the sole selected point [1852]
rmoestl Aug 30, 2018
d7c1434
Flag click-to-select tests of gl-based traces with @gl [1852]
rmoestl Aug 30, 2018
e895efd
Rename variable in `lib/select.js` [1852]
rmoestl Aug 30, 2018
60317b1
Adapt uninitialized var declarations in click-to-select code [1852]
rmoestl Aug 30, 2018
61b1a32
Add 'none' as an extra flag to clickmode [1852]
rmoestl Aug 30, 2018
e460e46
Simplify code for coercing selection cache state [1852]
rmoestl Aug 30, 2018
2ef3fce
Resolve TODO in cartesian/select.js regarding binned traces [1852]
rmoestl Aug 30, 2018
ac4b909
Remove lib/select.js and integrate code in cartesian/select.js [1852]
rmoestl Aug 30, 2018
c0f039f
bump regl-splom to 1.0.4
etpinard Aug 30, 2018
60d24cf
replace @etpinard/gl-text -> gl-text
etpinard Aug 30, 2018
05b50b9
Fix mapbox click-to-select bug caused by multiple click listeners [1852]
rmoestl Aug 30, 2018
88e9993
Fix testing click-to-select is inactive if clickmode is 'event' [1852]
rmoestl Sep 4, 2018
f247d93
Ensure 'plotly_click' is fired after 'plotly_selected' [1852]
rmoestl Sep 4, 2018
90ba209
Replace dynamic CI tags with static ones in select_test.js [1852]
rmoestl Sep 5, 2018
2bc582b
Apply @noCI tag to mapbox tests in select_test.js [1852]
rmoestl Sep 5, 2018
96fcdd7
Minor change: move helper method in select_test.s [1852]
rmoestl Sep 5, 2018
a5a90f9
Add a comment to select_test.js test [1852]
rmoestl Sep 6, 2018
39b2ee3
place <g.barlayer> below <g.scatterlayer> in polar subplot
etpinard Sep 6, 2018
ea7fd2c
add polar.hole
etpinard Sep 6, 2018
f547692
add a few TODO comments related to polar.hole
etpinard Sep 6, 2018
aeef7f7
fix layer ordering of scatter subtypes
alexcjohnson Sep 6, 2018
7c54fc2
put back text styling in scattergeo
alexcjohnson Sep 7, 2018
509ed7e
Merge branch 'master' into scatter-layer-order
alexcjohnson Sep 7, 2018
35199c6
make mock cartesian scale computation marginally simpler
etpinard Sep 7, 2018
8e5833d
cover a few more cases in polar_hole.json
etpinard Sep 7, 2018
ea877ee
add hover tests with polar.hole>0
etpinard Sep 7, 2018
87d0497
Default hovermode to closest if clickmode is select [1852]
rmoestl Sep 7, 2018
30789dd
Remove :hocho: obsolete polygon.multitester function [1852]
rmoestl Sep 7, 2018
cc2c9ba
Merge branch 'master' into 1852-persistent-click-via-selectPoints
rmoestl Sep 7, 2018
32aa219
Simplify clickmode / hovermode coercion code [1852]
rmoestl Sep 7, 2018
a859872
add info about polar.hole in setConvert jsdoc
etpinard Sep 7, 2018
776e292
modif polar_hole mock to "see" axis line/tick ordering
etpinard Sep 7, 2018
9c3dcef
draw polar axis ticks above axis lines
etpinard Sep 7, 2018
1122907
fix and :lock: maindrag when polar.hole>0
etpinard Sep 7, 2018
d466146
add 'inner' radial dragbox when polar.hole>0
etpinard Sep 7, 2018
24afe77
emit 'plotly_webglcontextlost' event on webgl context lost
etpinard Sep 7, 2018
b6bd813
Not throw error for no longer valid polygon.tester argument [1852]
rmoestl Sep 10, 2018
178feb5
Merge pull request #2956 from plotly/bump-regl-trace-deps
etpinard Sep 10, 2018
0de6e29
bump glslify
etpinard Sep 10, 2018
ee17d2e
fix #2765 - bump regl-line2d to 3.0.11
etpinard Sep 10, 2018
03be8ff
Merge branch 'master' into compress-attr-transform-by-default
etpinard Sep 10, 2018
ce2a33a
:hocho: now obsolete compressAttrs arg
etpinard Sep 10, 2018
7e7baaf
move plotschema_test to bundle_tests/
etpinard Sep 10, 2018
23647bd
guard against cases where gd.emit got purged
etpinard Sep 10, 2018
fdae65b
Merge pull request #2944 from plotly/1852-persistent-click-via-select…
rmoestl Sep 10, 2018
5a998a2
Merge branch 'master' into polar-hole
etpinard Sep 10, 2018
9af5948
rm info about compress_attributes transform
etpinard Sep 10, 2018
1b6c9a3
Merge pull request #1584 from plotly/compress-attr-transform-by-default
etpinard Sep 10, 2018
092006a
add 'inner' radial dragbox to all polar subplots
etpinard Sep 10, 2018
4265bab
emit 'plotly_webglcontextlost' for gl3d canvas
etpinard Sep 10, 2018
2a667d0
Merge pull request #2977 from plotly/polar-hole
etpinard Sep 10, 2018
7e282c3
add gl2d and gl3d plotly_webglcontextlost evt handler tests
etpinard Sep 10, 2018
b495131
fix and :lock: ternary showticklabels
etpinard Aug 20, 2018
05f58ce
mv ternary/layout/* to layout_defaults.js and layout_attributes.js
etpinard Sep 10, 2018
937f5cf
fix and :lock: ticks and tick labels hide/show edits
etpinard Sep 10, 2018
905956a
improve plotly_webglcontextlost tests
etpinard Sep 10, 2018
6988818
better algorithm for covering all state transitions
alexcjohnson Sep 11, 2018
045a162
fix fill ordering
etpinard Sep 11, 2018
f034c62
Merge pull request #2978 from plotly/scatter-layer-order
alexcjohnson Sep 11, 2018
3a38d73
test 'pick' canvas non-events on gl2d graphs
etpinard Sep 11, 2018
68e0628
wrap toggle() test functions
etpinard Sep 11, 2018
9d114c8
convert typed array to 'regular' arrays before sendToCloud
etpinard Sep 11, 2018
9372ea4
there are now 4 `<g.drag>` nodes in polar subplots
etpinard Sep 11, 2018
1fceea8
Merge pull request #2993 from plotly/ternary-noticks
etpinard Sep 11, 2018
cbbba35
Merge pull request #2986 from plotly/webgl-oncontext-loss
etpinard Sep 11, 2018
d0ee187
Merge pull request #2995 from plotly/graphJson-for-typed-arrays
etpinard Sep 11, 2018
c6cdcea
Merge pull request #2990 from plotly/regl-line2d-bump
etpinard Sep 11, 2018
344a6c5
Merge pull request #2996 from plotly/fixup-noci-polar-test
etpinard Sep 11, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@ then simply run,
browserify index.js > bundle.js
```

to trim meta information (and thus save a few bytes), run:


```
browserify -t path/to/plotly.js/tasks/util/compress_attributes.js index.js > bundle.js
```

## Angular CLI

Currently Angular CLI uses Webpack under the hood to bundle and build your Angular application.
Expand Down
69 changes: 35 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@
},
"browserify": {
"transform": [
"glslify"
"glslify",
"./tasks/compress_attributes.js"
]
},
"dependencies": {
"3d-view": "^2.0.0",
"@etpinard/gl-text": "^1.1.6",
"@plotly/d3-sankey": "^0.5.0",
"alpha-shape": "^1.0.0",
"array-range": "^1.0.1",
Expand Down Expand Up @@ -85,7 +85,8 @@
"gl-spikes2d": "^1.0.1",
"gl-streamtube3d": "^1.0.0",
"gl-surface3d": "^1.3.5",
"glslify": "^6.2.1",
"gl-text": "^1.1.6",
"glslify": "^6.3.1",
"has-hover": "^1.0.1",
"has-passive-events": "^1.0.0",
"mapbox-gl": "0.45.0",
Expand All @@ -101,9 +102,9 @@
"polybooljs": "^1.2.0",
"regl": "^1.3.7",
"regl-error2d": "^2.0.5",
"regl-line2d": "^3.0.9",
"regl-line2d": "^3.0.11",
"regl-scatter2d": "^3.0.6",
"regl-splom": "^1.0.3",
"regl-splom": "^1.0.4",
"right-now": "^1.0.0",
"robust-orientation": "^1.1.3",
"sane-topojson": "^2.0.0",
Expand Down
34 changes: 33 additions & 1 deletion src/components/fx/layout_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,29 @@ fontAttrs.family.dflt = constants.HOVERFONT;
fontAttrs.size.dflt = constants.HOVERFONTSIZE;

module.exports = {
clickmode: {
valType: 'flaglist',
role: 'info',
flags: ['event', 'select'],
dflt: 'event',
editType: 'plot',
extras: ['none'],
description: [
'Determines the mode of single click interactions.',
'*event* is the default value and emits the `plotly_click`',
'event. In addition this mode emits the `plotly_selected` event',
'in drag modes *lasso* and *select*, but with no event data attached',
'(kept for compatibility reasons).',
'The *select* flag enables selecting single',
'data points via click. This mode also supports persistent selections,',
'meaning that pressing Shift while clicking, adds to / subtracts from an',
'existing selection. *select* with `hovermode`: *x* can be confusing, consider',
'explicitly setting `hovermode`: *closest* when using this feature.',
'Selection events are sent accordingly as long as *event* flag is set as well.',
'When the *event* flag is missing, `plotly_click` and `plotly_selected`',
'events are not fired.'
].join(' ')
},
dragmode: {
valType: 'enumerated',
role: 'info',
Expand All @@ -36,7 +59,16 @@ module.exports = {
role: 'info',
values: ['x', 'y', 'closest', false],
editType: 'modebar',
description: 'Determines the mode of hover interactions.'
description: [
'Determines the mode of hover interactions.',
'If `clickmode` includes the *select* flag,',
'`hovermode` defaults to *closest*.',
'If `clickmode` lacks the *select* flag,',
'it defaults to *x* or *y* (depending on the trace\'s',
'`orientation` value) for plots based on',
'cartesian coordinates. For anything else the default',
'value is *closest*.',
].join(' ')
},
hoverdistance: {
valType: 'integer',
Expand Down
14 changes: 10 additions & 4 deletions src/components/fx/layout_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,21 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt);
}

var clickmode = coerce('clickmode');

var dragMode = coerce('dragmode');
if(dragMode === 'select') coerce('selectdirection');

var hovermodeDflt;
if(layoutOut._has('cartesian')) {
// flag for 'horizontal' plots:
// determines the state of the mode bar 'compare' hovermode button
layoutOut._isHoriz = isHoriz(fullData);
hovermodeDflt = layoutOut._isHoriz ? 'y' : 'x';
if(clickmode.indexOf('select') > -1) {
hovermodeDflt = 'closest';
} else {
// flag for 'horizontal' plots:
// determines the state of the mode bar 'compare' hovermode button
layoutOut._isHoriz = isHoriz(fullData);
hovermodeDflt = layoutOut._isHoriz ? 'y' : 'x';
}
}
else hovermodeDflt = 'closest';

Expand Down
4 changes: 3 additions & 1 deletion src/components/legend/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ module.exports = function style(s, gd) {

var pts = ptgroup.selectAll('path.scatterpts')
.data(showMarkers ? dMod : []);
pts.enter().append('path').classed('scatterpts', true)
// make sure marker is on the bottom, in case it enters after text
pts.enter().insert('path', ':first-child')
.classed('scatterpts', true)
.attr('transform', 'translate(20,0)');
pts.exit().remove();
pts.call(Drawing.pointStyle, tMod, gd);
Expand Down
46 changes: 0 additions & 46 deletions src/lib/polygon.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ var polygon = module.exports = {};
* returns boolean: is pt inside the polygon (including on its edges)
*/
polygon.tester = function tester(ptsIn) {
if(Array.isArray(ptsIn[0][0])) return polygon.multitester(ptsIn);

var pts = ptsIn.slice(),
xmin = pts[0][0],
xmax = xmin,
Expand Down Expand Up @@ -174,50 +172,6 @@ polygon.tester = function tester(ptsIn) {
};
};

/**
* Test multiple polygons
*/
polygon.multitester = function multitester(list) {
var testers = [],
xmin = list[0][0][0],
xmax = xmin,
ymin = list[0][0][1],
ymax = ymin;

for(var i = 0; i < list.length; i++) {
var tester = polygon.tester(list[i]);
tester.subtract = list[i].subtract;
testers.push(tester);
xmin = Math.min(xmin, tester.xmin);
xmax = Math.max(xmax, tester.xmax);
ymin = Math.min(ymin, tester.ymin);
ymax = Math.max(ymax, tester.ymax);
}

function contains(pt, arg) {
var yes = false;
for(var i = 0; i < testers.length; i++) {
if(testers[i].contains(pt, arg)) {
// if contained by subtract polygon - exclude the point
yes = testers[i].subtract === false;
}
}

return yes;
}

return {
xmin: xmin,
xmax: xmax,
ymin: ymin,
ymax: ymax,
pts: [],
contains: contains,
isRect: false,
degenerate: false
};
};

/**
* Test if a segment of a points array is bent or straight
*
Expand Down
11 changes: 11 additions & 0 deletions src/lib/prepare_regl.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ module.exports = function prepareRegl(gd, extensions) {
} catch(e) {
success = false;
}

if(success) {
this.addEventListener('webglcontextlost', function(event) {
if(gd && gd.emit) {
gd.emit('plotly_webglcontextlost', {
event: event,
layer: d.key
});
}
}, false);
}
});

if(!success) {
Expand Down
29 changes: 27 additions & 2 deletions src/plots/cartesian/dragbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var doTicksSingle = require('./axes').doTicksSingle;
var getFromId = require('./axis_ids').getFromId;
var prepSelect = require('./select').prepSelect;
var clearSelect = require('./select').clearSelect;
var selectOnClick = require('./select').selectOnClick;
var scaleZoom = require('./scale_zoom');

var constants = require('./constants');
Expand Down Expand Up @@ -148,7 +149,11 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
};

dragOptions.prepFn = function(e, startX, startY) {
var dragModePrev = dragOptions.dragmode;
var dragModeNow = gd._fullLayout.dragmode;
if(dragModeNow !== dragModePrev) {
dragOptions.dragmode = dragModeNow;
}

recomputeAxisLists();

Expand Down Expand Up @@ -178,7 +183,19 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
prepSelect(e, startX, startY, dragOptions, dragModeNow);
} else {
dragOptions.clickFn = clickFn;
clearAndResetSelect();
if(isSelectOrLasso(dragModePrev)) {
// TODO Fix potential bug
// Note: clearing / resetting selection state only happens, when user
// triggers at least one interaction in pan/zoom mode. Otherwise, the
// select/lasso outlines are deleted (in plots.js.cleanPlot) but the selection
// cache isn't cleared. So when the user switches back to select/lasso and
// 'adds to a selection' with Shift, the "old", seemingly removed outlines
// are redrawn again because the selection cache still holds their coordinates.
// However, this isn't easily solved, since plots.js would need
// to have a reference to the dragOptions object (which holds the
// selection cache).
clearAndResetSelect();
}

if(!allFixedRanges) {
if(dragModeNow === 'zoom') {
Expand Down Expand Up @@ -207,12 +224,20 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
}

function clickFn(numClicks, evt) {
var clickmode = gd._fullLayout.clickmode;

removeZoombox(gd);

if(numClicks === 2 && !singleEnd) doubleClick();

if(isMainDrag) {
Fx.click(gd, evt, plotinfo.id);
if(clickmode.indexOf('select') > -1) {
selectOnClick(evt, gd, xaxes, yaxes, plotinfo.id, dragOptions);
}

if(clickmode.indexOf('event') > -1) {
Fx.click(gd, evt, plotinfo.id);
}
}
else if(numClicks === 1 && singleEnd) {
var ax = ns ? ya0 : xa0,
Expand Down
Loading