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 (strict) v2.13.2
2
+ * plotly.js (strict) v2.13.3
3
3
  * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -121160,6 +121160,8 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
121160
121160
  }
121161
121161
 
121162
121162
  if(selectionErased) {
121163
+ gd._fullLayout._noEmitSelectedAtStart = true;
121164
+
121163
121165
  Registry.call('_guiRelayout', gd, {
121164
121166
  selections: list
121165
121167
  });
@@ -121301,10 +121303,10 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
121301
121303
  displayOutlines(convertPoly(mergedPolygons, isOpenMode), outlines, dragOptions);
121302
121304
 
121303
121305
  if(isSelectMode) {
121304
- var _res = reselect(gd);
121306
+ var _res = reselect(gd, false);
121305
121307
  var extraPoints = _res.eventData ? _res.eventData.points.slice() : [];
121306
121308
 
121307
- _res = reselect(gd, selectionTesters, searchTraces, dragOptions);
121309
+ _res = reselect(gd, false, selectionTesters, searchTraces, dragOptions);
121308
121310
  selectionTesters = _res.selectionTesters;
121309
121311
  eventData = _res.eventData;
121310
121312
 
@@ -121398,9 +121400,13 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
121398
121400
  }
121399
121401
  }
121400
121402
 
121401
- Registry.call('_guiRelayout', gd, {
121402
- selections: subSelections
121403
- });
121403
+ if(subSelections.length < allSelections.length) {
121404
+ gd._fullLayout._noEmitSelectedAtStart = true;
121405
+
121406
+ Registry.call('_guiRelayout', gd, {
121407
+ selections: subSelections
121408
+ });
121409
+ }
121404
121410
  }
121405
121411
  }
121406
121412
  } else {
@@ -121719,6 +121725,8 @@ function clearSelectionsCache(dragOptions, immediateSelect) {
121719
121725
  selections = newSelections(outlines, dragOptions);
121720
121726
  }
121721
121727
  if(selections) {
121728
+ gd._fullLayout._noEmitSelectedAtStart = true;
121729
+
121722
121730
  Registry.call('_guiRelayout', gd, {
121723
121731
  selections: selections
121724
121732
  }).then(function() {
@@ -122056,7 +122064,7 @@ function _doSelect(selectionTesters, searchTraces) {
122056
122064
  return allSelections;
122057
122065
  }
122058
122066
 
122059
- function reselect(gd, selectionTesters, searchTraces, dragOptions) {
122067
+ function reselect(gd, mayEmitSelected, selectionTesters, searchTraces, dragOptions) {
122060
122068
  var hadSearchTraces = !!searchTraces;
122061
122069
  var plotinfo, xRef, yRef;
122062
122070
  if(dragOptions) {
@@ -122179,15 +122187,15 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
122179
122187
  updateSelectedState(gd, allSearchTraces, eventData);
122180
122188
 
122181
122189
  var clickmode = fullLayout.clickmode;
122182
- var sendEvents = clickmode.indexOf('event') > -1;
122190
+ var sendEvents = clickmode.indexOf('event') > -1 && mayEmitSelected;
122183
122191
 
122184
122192
  if(
122185
122193
  !plotinfo && // get called from plot_api & plots
122186
- fullLayout._reselect
122194
+ mayEmitSelected
122187
122195
  ) {
122188
- if(sendEvents) {
122189
- var activePolygons = getLayoutPolygons(gd, true);
122196
+ var activePolygons = getLayoutPolygons(gd, true);
122190
122197
 
122198
+ if(activePolygons.length) {
122191
122199
  var xref = activePolygons[0].xref;
122192
122200
  var yref = activePolygons[0].yref;
122193
122201
  if(xref && yref) {
@@ -122200,8 +122208,12 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
122200
122208
 
122201
122209
  fillRangeItems(eventData, poly);
122202
122210
  }
122211
+ }
122203
122212
 
122204
- emitSelected(gd, eventData);
122213
+ if(gd._fullLayout._noEmitSelectedAtStart) {
122214
+ gd._fullLayout._noEmitSelectedAtStart = false;
122215
+ } else {
122216
+ if(sendEvents) emitSelected(gd, eventData);
122205
122217
  }
122206
122218
 
122207
122219
  fullLayout._reselect = false;
@@ -122223,7 +122235,7 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
122223
122235
  if(eventData.points.length) {
122224
122236
  emitSelected(gd, eventData);
122225
122237
  } else {
122226
- gd.emit('plotly_deselect', null);
122238
+ emitDeselect(gd);
122227
122239
  }
122228
122240
  }
122229
122241
 
@@ -190166,7 +190178,16 @@ plots.redrag = function(gd) {
190166
190178
  };
190167
190179
 
190168
190180
  plots.reselect = function(gd) {
190169
- Registry.getComponentMethod('selections', 'reselect')(gd);
190181
+ var fullLayout = gd._fullLayout;
190182
+
190183
+ var A = (gd.layout || {}).selections;
190184
+ var B = fullLayout._previousSelections;
190185
+ fullLayout._previousSelections = A;
190186
+
190187
+ var mayEmitSelected = fullLayout._reselect ||
190188
+ JSON.stringify(A) !== JSON.stringify(B);
190189
+
190190
+ Registry.getComponentMethod('selections', 'reselect')(gd, mayEmitSelected);
190170
190191
  };
190171
190192
 
190172
190193
  plots.generalUpdatePerTraceModule = function(gd, subplot, subplotCalcData, subplotLayout) {
@@ -249334,7 +249355,7 @@ function getSortFunc(opts, d2c) {
249334
249355
  'use strict';
249335
249356
 
249336
249357
  // package version injected by `npm run preprocess`
249337
- exports.version = '2.13.2';
249358
+ exports.version = '2.13.3';
249338
249359
 
249339
249360
  },{}],1151:[function(_dereq_,module,exports){
249340
249361
  (function (global){(function (){