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 (cartesian) v2.13.2
2
+ * plotly.js (cartesian) v2.13.3
3
3
  * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -45886,6 +45886,8 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
45886
45886
  }
45887
45887
 
45888
45888
  if(selectionErased) {
45889
+ gd._fullLayout._noEmitSelectedAtStart = true;
45890
+
45889
45891
  Registry.call('_guiRelayout', gd, {
45890
45892
  selections: list
45891
45893
  });
@@ -46027,10 +46029,10 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
46027
46029
  displayOutlines(convertPoly(mergedPolygons, isOpenMode), outlines, dragOptions);
46028
46030
 
46029
46031
  if(isSelectMode) {
46030
- var _res = reselect(gd);
46032
+ var _res = reselect(gd, false);
46031
46033
  var extraPoints = _res.eventData ? _res.eventData.points.slice() : [];
46032
46034
 
46033
- _res = reselect(gd, selectionTesters, searchTraces, dragOptions);
46035
+ _res = reselect(gd, false, selectionTesters, searchTraces, dragOptions);
46034
46036
  selectionTesters = _res.selectionTesters;
46035
46037
  eventData = _res.eventData;
46036
46038
 
@@ -46124,9 +46126,13 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
46124
46126
  }
46125
46127
  }
46126
46128
 
46127
- Registry.call('_guiRelayout', gd, {
46128
- selections: subSelections
46129
- });
46129
+ if(subSelections.length < allSelections.length) {
46130
+ gd._fullLayout._noEmitSelectedAtStart = true;
46131
+
46132
+ Registry.call('_guiRelayout', gd, {
46133
+ selections: subSelections
46134
+ });
46135
+ }
46130
46136
  }
46131
46137
  }
46132
46138
  } else {
@@ -46445,6 +46451,8 @@ function clearSelectionsCache(dragOptions, immediateSelect) {
46445
46451
  selections = newSelections(outlines, dragOptions);
46446
46452
  }
46447
46453
  if(selections) {
46454
+ gd._fullLayout._noEmitSelectedAtStart = true;
46455
+
46448
46456
  Registry.call('_guiRelayout', gd, {
46449
46457
  selections: selections
46450
46458
  }).then(function() {
@@ -46782,7 +46790,7 @@ function _doSelect(selectionTesters, searchTraces) {
46782
46790
  return allSelections;
46783
46791
  }
46784
46792
 
46785
- function reselect(gd, selectionTesters, searchTraces, dragOptions) {
46793
+ function reselect(gd, mayEmitSelected, selectionTesters, searchTraces, dragOptions) {
46786
46794
  var hadSearchTraces = !!searchTraces;
46787
46795
  var plotinfo, xRef, yRef;
46788
46796
  if(dragOptions) {
@@ -46905,15 +46913,15 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
46905
46913
  updateSelectedState(gd, allSearchTraces, eventData);
46906
46914
 
46907
46915
  var clickmode = fullLayout.clickmode;
46908
- var sendEvents = clickmode.indexOf('event') > -1;
46916
+ var sendEvents = clickmode.indexOf('event') > -1 && mayEmitSelected;
46909
46917
 
46910
46918
  if(
46911
46919
  !plotinfo && // get called from plot_api & plots
46912
- fullLayout._reselect
46920
+ mayEmitSelected
46913
46921
  ) {
46914
- if(sendEvents) {
46915
- var activePolygons = getLayoutPolygons(gd, true);
46922
+ var activePolygons = getLayoutPolygons(gd, true);
46916
46923
 
46924
+ if(activePolygons.length) {
46917
46925
  var xref = activePolygons[0].xref;
46918
46926
  var yref = activePolygons[0].yref;
46919
46927
  if(xref && yref) {
@@ -46926,8 +46934,12 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
46926
46934
 
46927
46935
  fillRangeItems(eventData, poly);
46928
46936
  }
46937
+ }
46929
46938
 
46930
- emitSelected(gd, eventData);
46939
+ if(gd._fullLayout._noEmitSelectedAtStart) {
46940
+ gd._fullLayout._noEmitSelectedAtStart = false;
46941
+ } else {
46942
+ if(sendEvents) emitSelected(gd, eventData);
46931
46943
  }
46932
46944
 
46933
46945
  fullLayout._reselect = false;
@@ -46949,7 +46961,7 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
46949
46961
  if(eventData.points.length) {
46950
46962
  emitSelected(gd, eventData);
46951
46963
  } else {
46952
- gd.emit('plotly_deselect', null);
46964
+ emitDeselect(gd);
46953
46965
  }
46954
46966
  }
46955
46967
 
@@ -83696,7 +83708,16 @@ plots.redrag = function(gd) {
83696
83708
  };
83697
83709
 
83698
83710
  plots.reselect = function(gd) {
83699
- Registry.getComponentMethod('selections', 'reselect')(gd);
83711
+ var fullLayout = gd._fullLayout;
83712
+
83713
+ var A = (gd.layout || {}).selections;
83714
+ var B = fullLayout._previousSelections;
83715
+ fullLayout._previousSelections = A;
83716
+
83717
+ var mayEmitSelected = fullLayout._reselect ||
83718
+ JSON.stringify(A) !== JSON.stringify(B);
83719
+
83720
+ Registry.getComponentMethod('selections', 'reselect')(gd, mayEmitSelected);
83700
83721
  };
83701
83722
 
83702
83723
  plots.generalUpdatePerTraceModule = function(gd, subplot, subplotCalcData, subplotLayout) {
@@ -104913,7 +104934,7 @@ function getSortFunc(opts, d2c) {
104913
104934
  'use strict';
104914
104935
 
104915
104936
  // package version injected by `npm run preprocess`
104916
- exports.version = '2.13.2';
104937
+ exports.version = '2.13.3';
104917
104938
 
104918
104939
  },{}]},{},[15])(15)
104919
104940
  });