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 (finance) v2.13.2
2
+ * plotly.js (finance) v2.13.3
3
3
  * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -37936,6 +37936,8 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
37936
37936
  }
37937
37937
 
37938
37938
  if(selectionErased) {
37939
+ gd._fullLayout._noEmitSelectedAtStart = true;
37940
+
37939
37941
  Registry.call('_guiRelayout', gd, {
37940
37942
  selections: list
37941
37943
  });
@@ -38077,10 +38079,10 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
38077
38079
  displayOutlines(convertPoly(mergedPolygons, isOpenMode), outlines, dragOptions);
38078
38080
 
38079
38081
  if(isSelectMode) {
38080
- var _res = reselect(gd);
38082
+ var _res = reselect(gd, false);
38081
38083
  var extraPoints = _res.eventData ? _res.eventData.points.slice() : [];
38082
38084
 
38083
- _res = reselect(gd, selectionTesters, searchTraces, dragOptions);
38085
+ _res = reselect(gd, false, selectionTesters, searchTraces, dragOptions);
38084
38086
  selectionTesters = _res.selectionTesters;
38085
38087
  eventData = _res.eventData;
38086
38088
 
@@ -38174,9 +38176,13 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
38174
38176
  }
38175
38177
  }
38176
38178
 
38177
- Registry.call('_guiRelayout', gd, {
38178
- selections: subSelections
38179
- });
38179
+ if(subSelections.length < allSelections.length) {
38180
+ gd._fullLayout._noEmitSelectedAtStart = true;
38181
+
38182
+ Registry.call('_guiRelayout', gd, {
38183
+ selections: subSelections
38184
+ });
38185
+ }
38180
38186
  }
38181
38187
  }
38182
38188
  } else {
@@ -38495,6 +38501,8 @@ function clearSelectionsCache(dragOptions, immediateSelect) {
38495
38501
  selections = newSelections(outlines, dragOptions);
38496
38502
  }
38497
38503
  if(selections) {
38504
+ gd._fullLayout._noEmitSelectedAtStart = true;
38505
+
38498
38506
  Registry.call('_guiRelayout', gd, {
38499
38507
  selections: selections
38500
38508
  }).then(function() {
@@ -38832,7 +38840,7 @@ function _doSelect(selectionTesters, searchTraces) {
38832
38840
  return allSelections;
38833
38841
  }
38834
38842
 
38835
- function reselect(gd, selectionTesters, searchTraces, dragOptions) {
38843
+ function reselect(gd, mayEmitSelected, selectionTesters, searchTraces, dragOptions) {
38836
38844
  var hadSearchTraces = !!searchTraces;
38837
38845
  var plotinfo, xRef, yRef;
38838
38846
  if(dragOptions) {
@@ -38955,15 +38963,15 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
38955
38963
  updateSelectedState(gd, allSearchTraces, eventData);
38956
38964
 
38957
38965
  var clickmode = fullLayout.clickmode;
38958
- var sendEvents = clickmode.indexOf('event') > -1;
38966
+ var sendEvents = clickmode.indexOf('event') > -1 && mayEmitSelected;
38959
38967
 
38960
38968
  if(
38961
38969
  !plotinfo && // get called from plot_api & plots
38962
- fullLayout._reselect
38970
+ mayEmitSelected
38963
38971
  ) {
38964
- if(sendEvents) {
38965
- var activePolygons = getLayoutPolygons(gd, true);
38972
+ var activePolygons = getLayoutPolygons(gd, true);
38966
38973
 
38974
+ if(activePolygons.length) {
38967
38975
  var xref = activePolygons[0].xref;
38968
38976
  var yref = activePolygons[0].yref;
38969
38977
  if(xref && yref) {
@@ -38976,8 +38984,12 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
38976
38984
 
38977
38985
  fillRangeItems(eventData, poly);
38978
38986
  }
38987
+ }
38979
38988
 
38980
- emitSelected(gd, eventData);
38989
+ if(gd._fullLayout._noEmitSelectedAtStart) {
38990
+ gd._fullLayout._noEmitSelectedAtStart = false;
38991
+ } else {
38992
+ if(sendEvents) emitSelected(gd, eventData);
38981
38993
  }
38982
38994
 
38983
38995
  fullLayout._reselect = false;
@@ -38999,7 +39011,7 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
38999
39011
  if(eventData.points.length) {
39000
39012
  emitSelected(gd, eventData);
39001
39013
  } else {
39002
- gd.emit('plotly_deselect', null);
39014
+ emitDeselect(gd);
39003
39015
  }
39004
39016
  }
39005
39017
 
@@ -75760,7 +75772,16 @@ plots.redrag = function(gd) {
75760
75772
  };
75761
75773
 
75762
75774
  plots.reselect = function(gd) {
75763
- Registry.getComponentMethod('selections', 'reselect')(gd);
75775
+ var fullLayout = gd._fullLayout;
75776
+
75777
+ var A = (gd.layout || {}).selections;
75778
+ var B = fullLayout._previousSelections;
75779
+ fullLayout._previousSelections = A;
75780
+
75781
+ var mayEmitSelected = fullLayout._reselect ||
75782
+ JSON.stringify(A) !== JSON.stringify(B);
75783
+
75784
+ Registry.getComponentMethod('selections', 'reselect')(gd, mayEmitSelected);
75764
75785
  };
75765
75786
 
75766
75787
  plots.generalUpdatePerTraceModule = function(gd, subplot, subplotCalcData, subplotLayout) {
@@ -92691,7 +92712,7 @@ function getSortFunc(opts, d2c) {
92691
92712
  'use strict';
92692
92713
 
92693
92714
  // package version injected by `npm run preprocess`
92694
- exports.version = '2.13.2';
92715
+ exports.version = '2.13.3';
92695
92716
 
92696
92717
  },{}]},{},[12])(12)
92697
92718
  });