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 v2.13.2
2
+ * plotly.js v2.13.3
3
3
  * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -122129,6 +122129,8 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
122129
122129
  }
122130
122130
 
122131
122131
  if(selectionErased) {
122132
+ gd._fullLayout._noEmitSelectedAtStart = true;
122133
+
122132
122134
  Registry.call('_guiRelayout', gd, {
122133
122135
  selections: list
122134
122136
  });
@@ -122270,10 +122272,10 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
122270
122272
  displayOutlines(convertPoly(mergedPolygons, isOpenMode), outlines, dragOptions);
122271
122273
 
122272
122274
  if(isSelectMode) {
122273
- var _res = reselect(gd);
122275
+ var _res = reselect(gd, false);
122274
122276
  var extraPoints = _res.eventData ? _res.eventData.points.slice() : [];
122275
122277
 
122276
- _res = reselect(gd, selectionTesters, searchTraces, dragOptions);
122278
+ _res = reselect(gd, false, selectionTesters, searchTraces, dragOptions);
122277
122279
  selectionTesters = _res.selectionTesters;
122278
122280
  eventData = _res.eventData;
122279
122281
 
@@ -122367,9 +122369,13 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
122367
122369
  }
122368
122370
  }
122369
122371
 
122370
- Registry.call('_guiRelayout', gd, {
122371
- selections: subSelections
122372
- });
122372
+ if(subSelections.length < allSelections.length) {
122373
+ gd._fullLayout._noEmitSelectedAtStart = true;
122374
+
122375
+ Registry.call('_guiRelayout', gd, {
122376
+ selections: subSelections
122377
+ });
122378
+ }
122373
122379
  }
122374
122380
  }
122375
122381
  } else {
@@ -122688,6 +122694,8 @@ function clearSelectionsCache(dragOptions, immediateSelect) {
122688
122694
  selections = newSelections(outlines, dragOptions);
122689
122695
  }
122690
122696
  if(selections) {
122697
+ gd._fullLayout._noEmitSelectedAtStart = true;
122698
+
122691
122699
  Registry.call('_guiRelayout', gd, {
122692
122700
  selections: selections
122693
122701
  }).then(function() {
@@ -123025,7 +123033,7 @@ function _doSelect(selectionTesters, searchTraces) {
123025
123033
  return allSelections;
123026
123034
  }
123027
123035
 
123028
- function reselect(gd, selectionTesters, searchTraces, dragOptions) {
123036
+ function reselect(gd, mayEmitSelected, selectionTesters, searchTraces, dragOptions) {
123029
123037
  var hadSearchTraces = !!searchTraces;
123030
123038
  var plotinfo, xRef, yRef;
123031
123039
  if(dragOptions) {
@@ -123148,15 +123156,15 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
123148
123156
  updateSelectedState(gd, allSearchTraces, eventData);
123149
123157
 
123150
123158
  var clickmode = fullLayout.clickmode;
123151
- var sendEvents = clickmode.indexOf('event') > -1;
123159
+ var sendEvents = clickmode.indexOf('event') > -1 && mayEmitSelected;
123152
123160
 
123153
123161
  if(
123154
123162
  !plotinfo && // get called from plot_api & plots
123155
- fullLayout._reselect
123163
+ mayEmitSelected
123156
123164
  ) {
123157
- if(sendEvents) {
123158
- var activePolygons = getLayoutPolygons(gd, true);
123165
+ var activePolygons = getLayoutPolygons(gd, true);
123159
123166
 
123167
+ if(activePolygons.length) {
123160
123168
  var xref = activePolygons[0].xref;
123161
123169
  var yref = activePolygons[0].yref;
123162
123170
  if(xref && yref) {
@@ -123169,8 +123177,12 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
123169
123177
 
123170
123178
  fillRangeItems(eventData, poly);
123171
123179
  }
123180
+ }
123172
123181
 
123173
- emitSelected(gd, eventData);
123182
+ if(gd._fullLayout._noEmitSelectedAtStart) {
123183
+ gd._fullLayout._noEmitSelectedAtStart = false;
123184
+ } else {
123185
+ if(sendEvents) emitSelected(gd, eventData);
123174
123186
  }
123175
123187
 
123176
123188
  fullLayout._reselect = false;
@@ -123192,7 +123204,7 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
123192
123204
  if(eventData.points.length) {
123193
123205
  emitSelected(gd, eventData);
123194
123206
  } else {
123195
- gd.emit('plotly_deselect', null);
123207
+ emitDeselect(gd);
123196
123208
  }
123197
123209
  }
123198
123210
 
@@ -170136,7 +170148,16 @@ plots.redrag = function(gd) {
170136
170148
  };
170137
170149
 
170138
170150
  plots.reselect = function(gd) {
170139
- Registry.getComponentMethod('selections', 'reselect')(gd);
170151
+ var fullLayout = gd._fullLayout;
170152
+
170153
+ var A = (gd.layout || {}).selections;
170154
+ var B = fullLayout._previousSelections;
170155
+ fullLayout._previousSelections = A;
170156
+
170157
+ var mayEmitSelected = fullLayout._reselect ||
170158
+ JSON.stringify(A) !== JSON.stringify(B);
170159
+
170160
+ Registry.getComponentMethod('selections', 'reselect')(gd, mayEmitSelected);
170140
170161
  };
170141
170162
 
170142
170163
  plots.generalUpdatePerTraceModule = function(gd, subplot, subplotCalcData, subplotLayout) {
@@ -232778,7 +232799,7 @@ function getSortFunc(opts, d2c) {
232778
232799
  'use strict';
232779
232800
 
232780
232801
  // package version injected by `npm run preprocess`
232781
- exports.version = '2.13.2';
232802
+ exports.version = '2.13.3';
232782
232803
 
232783
232804
  },{}],1133:[function(_dereq_,module,exports){
232784
232805
  (function (global){(function (){
package/dist/plotly.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * plotly.js v2.13.2
2
+ * plotly.js v2.13.3
3
3
  * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -121180,6 +121180,8 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
121180
121180
  }
121181
121181
 
121182
121182
  if(selectionErased) {
121183
+ gd._fullLayout._noEmitSelectedAtStart = true;
121184
+
121183
121185
  Registry.call('_guiRelayout', gd, {
121184
121186
  selections: list
121185
121187
  });
@@ -121321,10 +121323,10 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
121321
121323
  displayOutlines(convertPoly(mergedPolygons, isOpenMode), outlines, dragOptions);
121322
121324
 
121323
121325
  if(isSelectMode) {
121324
- var _res = reselect(gd);
121326
+ var _res = reselect(gd, false);
121325
121327
  var extraPoints = _res.eventData ? _res.eventData.points.slice() : [];
121326
121328
 
121327
- _res = reselect(gd, selectionTesters, searchTraces, dragOptions);
121329
+ _res = reselect(gd, false, selectionTesters, searchTraces, dragOptions);
121328
121330
  selectionTesters = _res.selectionTesters;
121329
121331
  eventData = _res.eventData;
121330
121332
 
@@ -121418,9 +121420,13 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
121418
121420
  }
121419
121421
  }
121420
121422
 
121421
- Registry.call('_guiRelayout', gd, {
121422
- selections: subSelections
121423
- });
121423
+ if(subSelections.length < allSelections.length) {
121424
+ gd._fullLayout._noEmitSelectedAtStart = true;
121425
+
121426
+ Registry.call('_guiRelayout', gd, {
121427
+ selections: subSelections
121428
+ });
121429
+ }
121424
121430
  }
121425
121431
  }
121426
121432
  } else {
@@ -121739,6 +121745,8 @@ function clearSelectionsCache(dragOptions, immediateSelect) {
121739
121745
  selections = newSelections(outlines, dragOptions);
121740
121746
  }
121741
121747
  if(selections) {
121748
+ gd._fullLayout._noEmitSelectedAtStart = true;
121749
+
121742
121750
  Registry.call('_guiRelayout', gd, {
121743
121751
  selections: selections
121744
121752
  }).then(function() {
@@ -122076,7 +122084,7 @@ function _doSelect(selectionTesters, searchTraces) {
122076
122084
  return allSelections;
122077
122085
  }
122078
122086
 
122079
- function reselect(gd, selectionTesters, searchTraces, dragOptions) {
122087
+ function reselect(gd, mayEmitSelected, selectionTesters, searchTraces, dragOptions) {
122080
122088
  var hadSearchTraces = !!searchTraces;
122081
122089
  var plotinfo, xRef, yRef;
122082
122090
  if(dragOptions) {
@@ -122199,15 +122207,15 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
122199
122207
  updateSelectedState(gd, allSearchTraces, eventData);
122200
122208
 
122201
122209
  var clickmode = fullLayout.clickmode;
122202
- var sendEvents = clickmode.indexOf('event') > -1;
122210
+ var sendEvents = clickmode.indexOf('event') > -1 && mayEmitSelected;
122203
122211
 
122204
122212
  if(
122205
122213
  !plotinfo && // get called from plot_api & plots
122206
- fullLayout._reselect
122214
+ mayEmitSelected
122207
122215
  ) {
122208
- if(sendEvents) {
122209
- var activePolygons = getLayoutPolygons(gd, true);
122216
+ var activePolygons = getLayoutPolygons(gd, true);
122210
122217
 
122218
+ if(activePolygons.length) {
122211
122219
  var xref = activePolygons[0].xref;
122212
122220
  var yref = activePolygons[0].yref;
122213
122221
  if(xref && yref) {
@@ -122220,8 +122228,12 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
122220
122228
 
122221
122229
  fillRangeItems(eventData, poly);
122222
122230
  }
122231
+ }
122223
122232
 
122224
- emitSelected(gd, eventData);
122233
+ if(gd._fullLayout._noEmitSelectedAtStart) {
122234
+ gd._fullLayout._noEmitSelectedAtStart = false;
122235
+ } else {
122236
+ if(sendEvents) emitSelected(gd, eventData);
122225
122237
  }
122226
122238
 
122227
122239
  fullLayout._reselect = false;
@@ -122243,7 +122255,7 @@ function reselect(gd, selectionTesters, searchTraces, dragOptions) {
122243
122255
  if(eventData.points.length) {
122244
122256
  emitSelected(gd, eventData);
122245
122257
  } else {
122246
- gd.emit('plotly_deselect', null);
122258
+ emitDeselect(gd);
122247
122259
  }
122248
122260
  }
122249
122261
 
@@ -167244,7 +167256,16 @@ plots.redrag = function(gd) {
167244
167256
  };
167245
167257
 
167246
167258
  plots.reselect = function(gd) {
167247
- Registry.getComponentMethod('selections', 'reselect')(gd);
167259
+ var fullLayout = gd._fullLayout;
167260
+
167261
+ var A = (gd.layout || {}).selections;
167262
+ var B = fullLayout._previousSelections;
167263
+ fullLayout._previousSelections = A;
167264
+
167265
+ var mayEmitSelected = fullLayout._reselect ||
167266
+ JSON.stringify(A) !== JSON.stringify(B);
167267
+
167268
+ Registry.getComponentMethod('selections', 'reselect')(gd, mayEmitSelected);
167248
167269
  };
167249
167270
 
167250
167271
  plots.generalUpdatePerTraceModule = function(gd, subplot, subplotCalcData, subplotLayout) {
@@ -226298,7 +226319,7 @@ function getSortFunc(opts, d2c) {
226298
226319
  'use strict';
226299
226320
 
226300
226321
  // package version injected by `npm run preprocess`
226301
- exports.version = '2.13.2';
226322
+ exports.version = '2.13.3';
226302
226323
 
226303
226324
  },{}],1133:[function(_dereq_,module,exports){
226304
226325
  (function (global){(function (){