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 (gl3d) v2.13.2
2
+ * plotly.js (gl3d) v2.13.3
3
3
  * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -37406,6 +37406,8 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
37406
37406
  }
37407
37407
 
37408
37408
  if(selectionErased) {
37409
+ gd._fullLayout._noEmitSelectedAtStart = true;
37410
+
37409
37411
  Registry.call('_guiRelayout', gd, {
37410
37412
  selections: list
37411
37413
  });
@@ -37547,10 +37549,10 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
37547
37549
  displayOutlines(convertPoly(mergedPolygons, isOpenMode), outlines, dragOptions);
37548
37550
 
37549
37551
  if(isSelectMode) {
37550
- var _res = reselect(gd);
37552
+ var _res = reselect(gd, false);
37551
37553
  var extraPoints = _res.eventData ? _res.eventData.points.slice() : [];
37552
37554
 
37553
- _res = reselect(gd, selectionTesters, searchTraces, dragOptions);
37555
+ _res = reselect(gd, false, selectionTesters, searchTraces, dragOptions);
37554
37556
  selectionTesters = _res.selectionTesters;
37555
37557
  eventData = _res.eventData;
37556
37558
 
@@ -37644,9 +37646,13 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
37644
37646
  }
37645
37647
  }
37646
37648
 
37647
- Registry.call('_guiRelayout', gd, {
37648
- selections: subSelections
37649
- });
37649
+ if(subSelections.length < allSelections.length) {
37650
+ gd._fullLayout._noEmitSelectedAtStart = true;
37651
+
37652
+ Registry.call('_guiRelayout', gd, {
37653
+ selections: subSelections
37654
+ });
37655
+ }
37650
37656
  }
37651
37657
  }
37652
37658
  } else {
@@ -37965,6 +37971,8 @@ function clearSelectionsCache(dragOptions, immediateSelect) {
37965
37971
  selections = newSelections(outlines, dragOptions);
37966
37972
  }
37967
37973
  if(selections) {
37974
+ gd._fullLayout._noEmitSelectedAtStart = true;
37975
+
37968
37976
  Registry.call('_guiRelayout', gd, {
37969
37977
  selections: selections
37970
37978
  }).then(function() {
@@ -38302,7 +38310,7 @@ function _doSelect(selectionTesters, searchTraces) {
38302
38310
  return allSelections;
38303
38311
  }
38304
38312
 
38305
- function reselect(gd, selectionTesters, searchTraces, dragOptions) {
38313
+ function reselect(gd, mayEmitSelected, selectionTesters, searchTraces, dragOptions) {
38306
38314
  var hadSearchTraces = !!searchTraces;
38307
38315
  var plotinfo, xRef, yRef;
38308
38316
  if(dragOptions) {
@@ -38425,15 +38433,15 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
38425
38433
  updateSelectedState(gd, allSearchTraces, eventData);
38426
38434
 
38427
38435
  var clickmode = fullLayout.clickmode;
38428
- var sendEvents = clickmode.indexOf('event') > -1;
38436
+ var sendEvents = clickmode.indexOf('event') > -1 && mayEmitSelected;
38429
38437
 
38430
38438
  if(
38431
38439
  !plotinfo && // get called from plot_api & plots
38432
- fullLayout._reselect
38440
+ mayEmitSelected
38433
38441
  ) {
38434
- if(sendEvents) {
38435
- var activePolygons = getLayoutPolygons(gd, true);
38442
+ var activePolygons = getLayoutPolygons(gd, true);
38436
38443
 
38444
+ if(activePolygons.length) {
38437
38445
  var xref = activePolygons[0].xref;
38438
38446
  var yref = activePolygons[0].yref;
38439
38447
  if(xref && yref) {
@@ -38446,8 +38454,12 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
38446
38454
 
38447
38455
  fillRangeItems(eventData, poly);
38448
38456
  }
38457
+ }
38449
38458
 
38450
- emitSelected(gd, eventData);
38459
+ if(gd._fullLayout._noEmitSelectedAtStart) {
38460
+ gd._fullLayout._noEmitSelectedAtStart = false;
38461
+ } else {
38462
+ if(sendEvents) emitSelected(gd, eventData);
38451
38463
  }
38452
38464
 
38453
38465
  fullLayout._reselect = false;
@@ -38469,7 +38481,7 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
38469
38481
  if(eventData.points.length) {
38470
38482
  emitSelected(gd, eventData);
38471
38483
  } else {
38472
- gd.emit('plotly_deselect', null);
38484
+ emitDeselect(gd);
38473
38485
  }
38474
38486
  }
38475
38487
 
@@ -77438,7 +77450,16 @@ plots.redrag = function(gd) {
77438
77450
  };
77439
77451
 
77440
77452
  plots.reselect = function(gd) {
77441
- Registry.getComponentMethod('selections', 'reselect')(gd);
77453
+ var fullLayout = gd._fullLayout;
77454
+
77455
+ var A = (gd.layout || {}).selections;
77456
+ var B = fullLayout._previousSelections;
77457
+ fullLayout._previousSelections = A;
77458
+
77459
+ var mayEmitSelected = fullLayout._reselect ||
77460
+ JSON.stringify(A) !== JSON.stringify(B);
77461
+
77462
+ Registry.getComponentMethod('selections', 'reselect')(gd, mayEmitSelected);
77442
77463
  };
77443
77464
 
77444
77465
  plots.generalUpdatePerTraceModule = function(gd, subplot, subplotCalcData, subplotLayout) {
@@ -88343,7 +88364,7 @@ function getSortFunc(opts, d2c) {
88343
88364
  'use strict';
88344
88365
 
88345
88366
  // package version injected by `npm run preprocess`
88346
- exports.version = '2.13.2';
88367
+ exports.version = '2.13.3';
88347
88368
 
88348
88369
  },{}],444:[function(_dereq_,module,exports){
88349
88370
  (function (global){(function (){