plotly.js 2.13.2 → 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * plotly.js (gl2d) v2.13.2
2
+ * plotly.js (gl2d) v2.13.3
3
3
  * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -50184,6 +50184,8 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
50184
50184
  }
50185
50185
 
50186
50186
  if(selectionErased) {
50187
+ gd._fullLayout._noEmitSelectedAtStart = true;
50188
+
50187
50189
  Registry.call('_guiRelayout', gd, {
50188
50190
  selections: list
50189
50191
  });
@@ -50325,10 +50327,10 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
50325
50327
  displayOutlines(convertPoly(mergedPolygons, isOpenMode), outlines, dragOptions);
50326
50328
 
50327
50329
  if(isSelectMode) {
50328
- var _res = reselect(gd);
50330
+ var _res = reselect(gd, false);
50329
50331
  var extraPoints = _res.eventData ? _res.eventData.points.slice() : [];
50330
50332
 
50331
- _res = reselect(gd, selectionTesters, searchTraces, dragOptions);
50333
+ _res = reselect(gd, false, selectionTesters, searchTraces, dragOptions);
50332
50334
  selectionTesters = _res.selectionTesters;
50333
50335
  eventData = _res.eventData;
50334
50336
 
@@ -50422,9 +50424,13 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
50422
50424
  }
50423
50425
  }
50424
50426
 
50425
- Registry.call('_guiRelayout', gd, {
50426
- selections: subSelections
50427
- });
50427
+ if(subSelections.length < allSelections.length) {
50428
+ gd._fullLayout._noEmitSelectedAtStart = true;
50429
+
50430
+ Registry.call('_guiRelayout', gd, {
50431
+ selections: subSelections
50432
+ });
50433
+ }
50428
50434
  }
50429
50435
  }
50430
50436
  } else {
@@ -50743,6 +50749,8 @@ function clearSelectionsCache(dragOptions, immediateSelect) {
50743
50749
  selections = newSelections(outlines, dragOptions);
50744
50750
  }
50745
50751
  if(selections) {
50752
+ gd._fullLayout._noEmitSelectedAtStart = true;
50753
+
50746
50754
  Registry.call('_guiRelayout', gd, {
50747
50755
  selections: selections
50748
50756
  }).then(function() {
@@ -51080,7 +51088,7 @@ function _doSelect(selectionTesters, searchTraces) {
51080
51088
  return allSelections;
51081
51089
  }
51082
51090
 
51083
- function reselect(gd, selectionTesters, searchTraces, dragOptions) {
51091
+ function reselect(gd, mayEmitSelected, selectionTesters, searchTraces, dragOptions) {
51084
51092
  var hadSearchTraces = !!searchTraces;
51085
51093
  var plotinfo, xRef, yRef;
51086
51094
  if(dragOptions) {
@@ -51203,15 +51211,15 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
51203
51211
  updateSelectedState(gd, allSearchTraces, eventData);
51204
51212
 
51205
51213
  var clickmode = fullLayout.clickmode;
51206
- var sendEvents = clickmode.indexOf('event') > -1;
51214
+ var sendEvents = clickmode.indexOf('event') > -1 && mayEmitSelected;
51207
51215
 
51208
51216
  if(
51209
51217
  !plotinfo && // get called from plot_api & plots
51210
- fullLayout._reselect
51218
+ mayEmitSelected
51211
51219
  ) {
51212
- if(sendEvents) {
51213
- var activePolygons = getLayoutPolygons(gd, true);
51220
+ var activePolygons = getLayoutPolygons(gd, true);
51214
51221
 
51222
+ if(activePolygons.length) {
51215
51223
  var xref = activePolygons[0].xref;
51216
51224
  var yref = activePolygons[0].yref;
51217
51225
  if(xref && yref) {
@@ -51224,8 +51232,12 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
51224
51232
 
51225
51233
  fillRangeItems(eventData, poly);
51226
51234
  }
51235
+ }
51227
51236
 
51228
- emitSelected(gd, eventData);
51237
+ if(gd._fullLayout._noEmitSelectedAtStart) {
51238
+ gd._fullLayout._noEmitSelectedAtStart = false;
51239
+ } else {
51240
+ if(sendEvents) emitSelected(gd, eventData);
51229
51241
  }
51230
51242
 
51231
51243
  fullLayout._reselect = false;
@@ -51247,7 +51259,7 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
51247
51259
  if(eventData.points.length) {
51248
51260
  emitSelected(gd, eventData);
51249
51261
  } else {
51250
- gd.emit('plotly_deselect', null);
51262
+ emitDeselect(gd);
51251
51263
  }
51252
51264
  }
51253
51265
 
@@ -89626,7 +89638,16 @@ plots.redrag = function(gd) {
89626
89638
  };
89627
89639
 
89628
89640
  plots.reselect = function(gd) {
89629
- Registry.getComponentMethod('selections', 'reselect')(gd);
89641
+ var fullLayout = gd._fullLayout;
89642
+
89643
+ var A = (gd.layout || {}).selections;
89644
+ var B = fullLayout._previousSelections;
89645
+ fullLayout._previousSelections = A;
89646
+
89647
+ var mayEmitSelected = fullLayout._reselect ||
89648
+ JSON.stringify(A) !== JSON.stringify(B);
89649
+
89650
+ Registry.getComponentMethod('selections', 'reselect')(gd, mayEmitSelected);
89630
89651
  };
89631
89652
 
89632
89653
  plots.generalUpdatePerTraceModule = function(gd, subplot, subplotCalcData, subplotLayout) {
@@ -103032,7 +103053,7 @@ function getSortFunc(opts, d2c) {
103032
103053
  'use strict';
103033
103054
 
103034
103055
  // package version injected by `npm run preprocess`
103035
- exports.version = '2.13.2';
103056
+ exports.version = '2.13.3';
103036
103057
 
103037
103058
  },{}],600:[function(_dereq_,module,exports){
103038
103059
  (function (global){(function (){