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 (mapbox) v2.13.2
2
+ * plotly.js (mapbox) v2.13.3
3
3
  * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -83979,6 +83979,8 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
83979
83979
  }
83980
83980
 
83981
83981
  if(selectionErased) {
83982
+ gd._fullLayout._noEmitSelectedAtStart = true;
83983
+
83982
83984
  Registry.call('_guiRelayout', gd, {
83983
83985
  selections: list
83984
83986
  });
@@ -84120,10 +84122,10 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
84120
84122
  displayOutlines(convertPoly(mergedPolygons, isOpenMode), outlines, dragOptions);
84121
84123
 
84122
84124
  if(isSelectMode) {
84123
- var _res = reselect(gd);
84125
+ var _res = reselect(gd, false);
84124
84126
  var extraPoints = _res.eventData ? _res.eventData.points.slice() : [];
84125
84127
 
84126
- _res = reselect(gd, selectionTesters, searchTraces, dragOptions);
84128
+ _res = reselect(gd, false, selectionTesters, searchTraces, dragOptions);
84127
84129
  selectionTesters = _res.selectionTesters;
84128
84130
  eventData = _res.eventData;
84129
84131
 
@@ -84217,9 +84219,13 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
84217
84219
  }
84218
84220
  }
84219
84221
 
84220
- Registry.call('_guiRelayout', gd, {
84221
- selections: subSelections
84222
- });
84222
+ if(subSelections.length < allSelections.length) {
84223
+ gd._fullLayout._noEmitSelectedAtStart = true;
84224
+
84225
+ Registry.call('_guiRelayout', gd, {
84226
+ selections: subSelections
84227
+ });
84228
+ }
84223
84229
  }
84224
84230
  }
84225
84231
  } else {
@@ -84538,6 +84544,8 @@ function clearSelectionsCache(dragOptions, immediateSelect) {
84538
84544
  selections = newSelections(outlines, dragOptions);
84539
84545
  }
84540
84546
  if(selections) {
84547
+ gd._fullLayout._noEmitSelectedAtStart = true;
84548
+
84541
84549
  Registry.call('_guiRelayout', gd, {
84542
84550
  selections: selections
84543
84551
  }).then(function() {
@@ -84875,7 +84883,7 @@ function _doSelect(selectionTesters, searchTraces) {
84875
84883
  return allSelections;
84876
84884
  }
84877
84885
 
84878
- function reselect(gd, selectionTesters, searchTraces, dragOptions) {
84886
+ function reselect(gd, mayEmitSelected, selectionTesters, searchTraces, dragOptions) {
84879
84887
  var hadSearchTraces = !!searchTraces;
84880
84888
  var plotinfo, xRef, yRef;
84881
84889
  if(dragOptions) {
@@ -84998,15 +85006,15 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
84998
85006
  updateSelectedState(gd, allSearchTraces, eventData);
84999
85007
 
85000
85008
  var clickmode = fullLayout.clickmode;
85001
- var sendEvents = clickmode.indexOf('event') > -1;
85009
+ var sendEvents = clickmode.indexOf('event') > -1 && mayEmitSelected;
85002
85010
 
85003
85011
  if(
85004
85012
  !plotinfo && // get called from plot_api & plots
85005
- fullLayout._reselect
85013
+ mayEmitSelected
85006
85014
  ) {
85007
- if(sendEvents) {
85008
- var activePolygons = getLayoutPolygons(gd, true);
85015
+ var activePolygons = getLayoutPolygons(gd, true);
85009
85016
 
85017
+ if(activePolygons.length) {
85010
85018
  var xref = activePolygons[0].xref;
85011
85019
  var yref = activePolygons[0].yref;
85012
85020
  if(xref && yref) {
@@ -85019,8 +85027,12 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
85019
85027
 
85020
85028
  fillRangeItems(eventData, poly);
85021
85029
  }
85030
+ }
85022
85031
 
85023
- emitSelected(gd, eventData);
85032
+ if(gd._fullLayout._noEmitSelectedAtStart) {
85033
+ gd._fullLayout._noEmitSelectedAtStart = false;
85034
+ } else {
85035
+ if(sendEvents) emitSelected(gd, eventData);
85024
85036
  }
85025
85037
 
85026
85038
  fullLayout._reselect = false;
@@ -85042,7 +85054,7 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
85042
85054
  if(eventData.points.length) {
85043
85055
  emitSelected(gd, eventData);
85044
85056
  } else {
85045
- gd.emit('plotly_deselect', null);
85057
+ emitDeselect(gd);
85046
85058
  }
85047
85059
  }
85048
85060
 
@@ -124241,7 +124253,16 @@ plots.redrag = function(gd) {
124241
124253
  };
124242
124254
 
124243
124255
  plots.reselect = function(gd) {
124244
- Registry.getComponentMethod('selections', 'reselect')(gd);
124256
+ var fullLayout = gd._fullLayout;
124257
+
124258
+ var A = (gd.layout || {}).selections;
124259
+ var B = fullLayout._previousSelections;
124260
+ fullLayout._previousSelections = A;
124261
+
124262
+ var mayEmitSelected = fullLayout._reselect ||
124263
+ JSON.stringify(A) !== JSON.stringify(B);
124264
+
124265
+ Registry.getComponentMethod('selections', 'reselect')(gd, mayEmitSelected);
124245
124266
  };
124246
124267
 
124247
124268
  plots.generalUpdatePerTraceModule = function(gd, subplot, subplotCalcData, subplotLayout) {
@@ -131893,7 +131914,7 @@ function getSortFunc(opts, d2c) {
131893
131914
  'use strict';
131894
131915
 
131895
131916
  // package version injected by `npm run preprocess`
131896
- exports.version = '2.13.2';
131917
+ exports.version = '2.13.3';
131897
131918
 
131898
131919
  },{}]},{},[9])(9)
131899
131920
  });