plotly.js 2.13.0 → 2.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +3 -3
- package/dist/README.md +26 -26
- package/dist/plotly-basic.js +71 -28
- package/dist/plotly-basic.min.js +2 -2
- package/dist/plotly-cartesian.js +71 -28
- package/dist/plotly-cartesian.min.js +2 -2
- package/dist/plotly-finance.js +71 -28
- package/dist/plotly-finance.min.js +2 -2
- package/dist/plotly-geo-assets.js +2 -2
- package/dist/plotly-geo.js +71 -28
- package/dist/plotly-geo.min.js +2 -2
- package/dist/plotly-gl2d.js +71 -28
- package/dist/plotly-gl2d.min.js +2 -2
- package/dist/plotly-gl3d.js +71 -28
- package/dist/plotly-gl3d.min.js +2 -2
- package/dist/plotly-mapbox.js +71 -28
- package/dist/plotly-mapbox.min.js +2 -2
- package/dist/plotly-strict.js +72 -28
- package/dist/plotly-strict.min.js +2 -2
- package/dist/plotly-with-meta.js +72 -28
- package/dist/plotly.js +72 -28
- package/dist/plotly.min.js +2 -2
- package/package.json +1 -1
- package/src/components/selections/select.js +59 -25
- package/src/plots/plots.js +10 -1
- package/src/traces/sankey/base_plot.js +1 -0
- package/src/version.js +1 -1
package/package.json
CHANGED
|
@@ -50,7 +50,14 @@ var p2r = helpers.p2r;
|
|
|
50
50
|
var axValue = helpers.axValue;
|
|
51
51
|
var getTransform = helpers.getTransform;
|
|
52
52
|
|
|
53
|
+
function hasSubplot(dragOptions) {
|
|
54
|
+
// N.B. subplot may be falsy e.g zero sankey index!
|
|
55
|
+
return dragOptions.subplot !== undefined;
|
|
56
|
+
}
|
|
57
|
+
|
|
53
58
|
function prepSelect(evt, startX, startY, dragOptions, mode) {
|
|
59
|
+
var isCartesian = !hasSubplot(dragOptions);
|
|
60
|
+
|
|
54
61
|
var isFreeMode = freeMode(mode);
|
|
55
62
|
var isRectMode = rectMode(mode);
|
|
56
63
|
var isOpenMode = openMode(mode);
|
|
@@ -64,7 +71,7 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
|
|
|
64
71
|
var gd = dragOptions.gd;
|
|
65
72
|
var fullLayout = gd._fullLayout;
|
|
66
73
|
var immediateSelect = isSelectMode && fullLayout.newselection.mode === 'immediate' &&
|
|
67
|
-
|
|
74
|
+
isCartesian; // N.B. only cartesian subplots have persistent selection
|
|
68
75
|
|
|
69
76
|
var zoomLayer = fullLayout._zoomlayer;
|
|
70
77
|
var dragBBox = dragOptions.element.getBoundingClientRect();
|
|
@@ -112,9 +119,9 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
|
|
|
112
119
|
opacity: isDrawMode ? newStyle.opacity / 2 : 1,
|
|
113
120
|
fill: (isDrawMode && !isOpenMode) ? newStyle.fillcolor : 'none',
|
|
114
121
|
stroke: newStyle.line.color || (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
122
|
+
isCartesian ?
|
|
123
|
+
Color.contrast(gd._fullLayout.plot_bgcolor) :
|
|
124
|
+
'#7f7f7f' // non-cartesian subplot
|
|
118
125
|
),
|
|
119
126
|
'stroke-dasharray': dashStyle(newStyle.line.dash, newStyle.line.width),
|
|
120
127
|
'stroke-width': newStyle.line.width + 'px',
|
|
@@ -145,6 +152,8 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
|
|
|
145
152
|
|
|
146
153
|
if(immediateSelect && !evt.shiftKey) {
|
|
147
154
|
dragOptions._clearSubplotSelections = function() {
|
|
155
|
+
if(!isCartesian) return;
|
|
156
|
+
|
|
148
157
|
var xRef = xAxis._id;
|
|
149
158
|
var yRef = yAxis._id;
|
|
150
159
|
deselectSubplot(gd, xRef, yRef, searchTraces);
|
|
@@ -165,6 +174,8 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
|
|
|
165
174
|
}
|
|
166
175
|
|
|
167
176
|
if(selectionErased) {
|
|
177
|
+
gd._fullLayout._noEmitSelectedAtStart = true;
|
|
178
|
+
|
|
168
179
|
Registry.call('_guiRelayout', gd, {
|
|
169
180
|
selections: list
|
|
170
181
|
});
|
|
@@ -306,10 +317,10 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
|
|
|
306
317
|
displayOutlines(convertPoly(mergedPolygons, isOpenMode), outlines, dragOptions);
|
|
307
318
|
|
|
308
319
|
if(isSelectMode) {
|
|
309
|
-
var _res = reselect(gd);
|
|
320
|
+
var _res = reselect(gd, false);
|
|
310
321
|
var extraPoints = _res.eventData ? _res.eventData.points.slice() : [];
|
|
311
322
|
|
|
312
|
-
_res = reselect(gd, selectionTesters, searchTraces, dragOptions);
|
|
323
|
+
_res = reselect(gd, false, selectionTesters, searchTraces, dragOptions);
|
|
313
324
|
selectionTesters = _res.selectionTesters;
|
|
314
325
|
eventData = _res.eventData;
|
|
315
326
|
|
|
@@ -403,9 +414,13 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
|
|
|
403
414
|
}
|
|
404
415
|
}
|
|
405
416
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
417
|
+
if(subSelections.length < allSelections.length) {
|
|
418
|
+
gd._fullLayout._noEmitSelectedAtStart = true;
|
|
419
|
+
|
|
420
|
+
Registry.call('_guiRelayout', gd, {
|
|
421
|
+
selections: subSelections
|
|
422
|
+
});
|
|
423
|
+
}
|
|
409
424
|
}
|
|
410
425
|
}
|
|
411
426
|
} else {
|
|
@@ -451,8 +466,9 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
|
|
|
451
466
|
dragOptions.doneFnCompleted(selection);
|
|
452
467
|
}
|
|
453
468
|
|
|
454
|
-
|
|
455
|
-
|
|
469
|
+
if(isSelectMode) {
|
|
470
|
+
emitSelected(gd, eventData);
|
|
471
|
+
}
|
|
456
472
|
}).catch(Lib.error);
|
|
457
473
|
};
|
|
458
474
|
}
|
|
@@ -530,7 +546,6 @@ function selectOnClick(evt, gd, xAxes, yAxes, subplot, dragOptions, polygonOutli
|
|
|
530
546
|
}
|
|
531
547
|
|
|
532
548
|
if(sendEvents) {
|
|
533
|
-
eventData.selections = gd.layout.selections;
|
|
534
549
|
emitSelected(gd, eventData);
|
|
535
550
|
}
|
|
536
551
|
}
|
|
@@ -675,15 +690,23 @@ function coerceSelectionsCache(evt, gd, dragOptions) {
|
|
|
675
690
|
}
|
|
676
691
|
}
|
|
677
692
|
|
|
693
|
+
function hasActiveShape(gd) {
|
|
694
|
+
return gd._fullLayout._activeShapeIndex >= 0;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
function hasActiveSelection(gd) {
|
|
698
|
+
return gd._fullLayout._activeSelectionIndex >= 0;
|
|
699
|
+
}
|
|
700
|
+
|
|
678
701
|
function clearSelectionsCache(dragOptions, immediateSelect) {
|
|
679
702
|
var dragmode = dragOptions.dragmode;
|
|
680
703
|
var plotinfo = dragOptions.plotinfo;
|
|
681
704
|
|
|
682
705
|
var gd = dragOptions.gd;
|
|
683
|
-
if(gd
|
|
706
|
+
if(hasActiveShape(gd)) {
|
|
684
707
|
gd._fullLayout._deactivateShape(gd);
|
|
685
708
|
}
|
|
686
|
-
if(gd
|
|
709
|
+
if(hasActiveSelection(gd)) {
|
|
687
710
|
gd._fullLayout._deactivateSelection(gd);
|
|
688
711
|
}
|
|
689
712
|
|
|
@@ -711,11 +734,13 @@ function clearSelectionsCache(dragOptions, immediateSelect) {
|
|
|
711
734
|
var selections;
|
|
712
735
|
if(
|
|
713
736
|
isSelectMode &&
|
|
714
|
-
!dragOptions
|
|
737
|
+
!hasSubplot(dragOptions) // only allow cartesian - no mapbox for now
|
|
715
738
|
) {
|
|
716
739
|
selections = newSelections(outlines, dragOptions);
|
|
717
740
|
}
|
|
718
741
|
if(selections) {
|
|
742
|
+
gd._fullLayout._noEmitSelectedAtStart = true;
|
|
743
|
+
|
|
719
744
|
Registry.call('_guiRelayout', gd, {
|
|
720
745
|
selections: selections
|
|
721
746
|
}).then(function() {
|
|
@@ -750,7 +775,10 @@ function determineSearchTraces(gd, xAxes, yAxes, subplot) {
|
|
|
750
775
|
|
|
751
776
|
if(trace.visible !== true || !trace._module || !trace._module.selectPoints) continue;
|
|
752
777
|
|
|
753
|
-
if(
|
|
778
|
+
if(
|
|
779
|
+
hasSubplot({subplot: subplot}) &&
|
|
780
|
+
(trace.subplot === subplot || trace.geo === subplot)
|
|
781
|
+
) {
|
|
754
782
|
searchTraces.push(createSearchInfo(trace._module, cd, xAxes[0], yAxes[0]));
|
|
755
783
|
} else if(trace.type === 'splom') {
|
|
756
784
|
// FIXME: make sure we don't have more than single axis for splom
|
|
@@ -1050,7 +1078,7 @@ function _doSelect(selectionTesters, searchTraces) {
|
|
|
1050
1078
|
return allSelections;
|
|
1051
1079
|
}
|
|
1052
1080
|
|
|
1053
|
-
function reselect(gd, selectionTesters, searchTraces, dragOptions) {
|
|
1081
|
+
function reselect(gd, mayEmitSelected, selectionTesters, searchTraces, dragOptions) {
|
|
1054
1082
|
var hadSearchTraces = !!searchTraces;
|
|
1055
1083
|
var plotinfo, xRef, yRef;
|
|
1056
1084
|
if(dragOptions) {
|
|
@@ -1173,15 +1201,15 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
|
|
|
1173
1201
|
updateSelectedState(gd, allSearchTraces, eventData);
|
|
1174
1202
|
|
|
1175
1203
|
var clickmode = fullLayout.clickmode;
|
|
1176
|
-
var sendEvents = clickmode.indexOf('event') > -1;
|
|
1204
|
+
var sendEvents = clickmode.indexOf('event') > -1 && mayEmitSelected;
|
|
1177
1205
|
|
|
1178
1206
|
if(
|
|
1179
1207
|
!plotinfo && // get called from plot_api & plots
|
|
1180
|
-
|
|
1208
|
+
mayEmitSelected
|
|
1181
1209
|
) {
|
|
1182
|
-
|
|
1183
|
-
var activePolygons = getLayoutPolygons(gd, true);
|
|
1210
|
+
var activePolygons = getLayoutPolygons(gd, true);
|
|
1184
1211
|
|
|
1212
|
+
if(activePolygons.length) {
|
|
1185
1213
|
var xref = activePolygons[0].xref;
|
|
1186
1214
|
var yref = activePolygons[0].yref;
|
|
1187
1215
|
if(xref && yref) {
|
|
@@ -1194,9 +1222,12 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
|
|
|
1194
1222
|
|
|
1195
1223
|
fillRangeItems(eventData, poly);
|
|
1196
1224
|
}
|
|
1225
|
+
}
|
|
1197
1226
|
|
|
1198
|
-
|
|
1199
|
-
|
|
1227
|
+
if(gd._fullLayout._noEmitSelectedAtStart) {
|
|
1228
|
+
gd._fullLayout._noEmitSelectedAtStart = false;
|
|
1229
|
+
} else {
|
|
1230
|
+
if(sendEvents) emitSelected(gd, eventData);
|
|
1200
1231
|
}
|
|
1201
1232
|
|
|
1202
1233
|
fullLayout._reselect = false;
|
|
@@ -1216,10 +1247,9 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
|
|
|
1216
1247
|
|
|
1217
1248
|
if(sendEvents) {
|
|
1218
1249
|
if(eventData.points.length) {
|
|
1219
|
-
eventData.selections = gd.layout.selections;
|
|
1220
1250
|
emitSelected(gd, eventData);
|
|
1221
1251
|
} else {
|
|
1222
|
-
gd
|
|
1252
|
+
emitDeselect(gd);
|
|
1223
1253
|
}
|
|
1224
1254
|
}
|
|
1225
1255
|
|
|
@@ -1511,6 +1541,10 @@ function emitSelecting(gd, eventData) {
|
|
|
1511
1541
|
}
|
|
1512
1542
|
|
|
1513
1543
|
function emitSelected(gd, eventData) {
|
|
1544
|
+
if(eventData) {
|
|
1545
|
+
eventData.selections = (gd.layout || {}).selections || [];
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1514
1548
|
gd.emit('plotly_selected', eventData);
|
|
1515
1549
|
}
|
|
1516
1550
|
|
package/src/plots/plots.js
CHANGED
|
@@ -3364,7 +3364,16 @@ plots.redrag = function(gd) {
|
|
|
3364
3364
|
};
|
|
3365
3365
|
|
|
3366
3366
|
plots.reselect = function(gd) {
|
|
3367
|
-
|
|
3367
|
+
var fullLayout = gd._fullLayout;
|
|
3368
|
+
|
|
3369
|
+
var A = (gd.layout || {}).selections;
|
|
3370
|
+
var B = fullLayout._previousSelections;
|
|
3371
|
+
fullLayout._previousSelections = A;
|
|
3372
|
+
|
|
3373
|
+
var mayEmitSelected = fullLayout._reselect ||
|
|
3374
|
+
JSON.stringify(A) !== JSON.stringify(B);
|
|
3375
|
+
|
|
3376
|
+
Registry.getComponentMethod('selections', 'reselect')(gd, mayEmitSelected);
|
|
3368
3377
|
};
|
|
3369
3378
|
|
|
3370
3379
|
plots.generalUpdatePerTraceModule = function(gd, subplot, subplotCalcData, subplotLayout) {
|
|
@@ -48,6 +48,7 @@ function subplotUpdateFx(gd, index) {
|
|
|
48
48
|
var dragMode = fullLayout.dragmode;
|
|
49
49
|
var cursor = fullLayout.dragmode === 'pan' ? 'move' : 'crosshair';
|
|
50
50
|
var bgRect = trace._bgRect;
|
|
51
|
+
if(!bgRect) return;
|
|
51
52
|
|
|
52
53
|
if(dragMode === 'pan' || dragMode === 'zoom') return;
|
|
53
54
|
|
package/src/version.js
CHANGED