plotly.js 2.13.1 → 2.13.2

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.1
2
+ * plotly.js (cartesian) v2.13.2
3
3
  * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -45762,7 +45762,14 @@ var p2r = helpers.p2r;
45762
45762
  var axValue = helpers.axValue;
45763
45763
  var getTransform = helpers.getTransform;
45764
45764
 
45765
+ function hasSubplot(dragOptions) {
45766
+ // N.B. subplot may be falsy e.g zero sankey index!
45767
+ return dragOptions.subplot !== undefined;
45768
+ }
45769
+
45765
45770
  function prepSelect(evt, startX, startY, dragOptions, mode) {
45771
+ var isCartesian = !hasSubplot(dragOptions);
45772
+
45766
45773
  var isFreeMode = freeMode(mode);
45767
45774
  var isRectMode = rectMode(mode);
45768
45775
  var isOpenMode = openMode(mode);
@@ -45776,7 +45783,7 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
45776
45783
  var gd = dragOptions.gd;
45777
45784
  var fullLayout = gd._fullLayout;
45778
45785
  var immediateSelect = isSelectMode && fullLayout.newselection.mode === 'immediate' &&
45779
- !dragOptions.subplot; // N.B. only cartesian subplots have persistent selection
45786
+ isCartesian; // N.B. only cartesian subplots have persistent selection
45780
45787
 
45781
45788
  var zoomLayer = fullLayout._zoomlayer;
45782
45789
  var dragBBox = dragOptions.element.getBoundingClientRect();
@@ -45824,9 +45831,9 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
45824
45831
  opacity: isDrawMode ? newStyle.opacity / 2 : 1,
45825
45832
  fill: (isDrawMode && !isOpenMode) ? newStyle.fillcolor : 'none',
45826
45833
  stroke: newStyle.line.color || (
45827
- dragOptions.subplot !== undefined ?
45828
- '#7f7f7f' : // non-cartesian subplot
45829
- Color.contrast(gd._fullLayout.plot_bgcolor) // cartesian subplot
45834
+ isCartesian ?
45835
+ Color.contrast(gd._fullLayout.plot_bgcolor) :
45836
+ '#7f7f7f' // non-cartesian subplot
45830
45837
  ),
45831
45838
  'stroke-dasharray': dashStyle(newStyle.line.dash, newStyle.line.width),
45832
45839
  'stroke-width': newStyle.line.width + 'px',
@@ -45857,6 +45864,8 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
45857
45864
 
45858
45865
  if(immediateSelect && !evt.shiftKey) {
45859
45866
  dragOptions._clearSubplotSelections = function() {
45867
+ if(!isCartesian) return;
45868
+
45860
45869
  var xRef = xAxis._id;
45861
45870
  var yRef = yAxis._id;
45862
45871
  deselectSubplot(gd, xRef, yRef, searchTraces);
@@ -46163,7 +46172,9 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
46163
46172
  dragOptions.doneFnCompleted(selection);
46164
46173
  }
46165
46174
 
46166
- emitSelected(gd, eventData);
46175
+ if(isSelectMode) {
46176
+ emitSelected(gd, eventData);
46177
+ }
46167
46178
  }).catch(Lib.error);
46168
46179
  };
46169
46180
  }
@@ -46385,15 +46396,23 @@ function coerceSelectionsCache(evt, gd, dragOptions) {
46385
46396
  }
46386
46397
  }
46387
46398
 
46399
+ function hasActiveShape(gd) {
46400
+ return gd._fullLayout._activeShapeIndex >= 0;
46401
+ }
46402
+
46403
+ function hasActiveSelection(gd) {
46404
+ return gd._fullLayout._activeSelectionIndex >= 0;
46405
+ }
46406
+
46388
46407
  function clearSelectionsCache(dragOptions, immediateSelect) {
46389
46408
  var dragmode = dragOptions.dragmode;
46390
46409
  var plotinfo = dragOptions.plotinfo;
46391
46410
 
46392
46411
  var gd = dragOptions.gd;
46393
- if(gd._fullLayout._activeShapeIndex >= 0) {
46412
+ if(hasActiveShape(gd)) {
46394
46413
  gd._fullLayout._deactivateShape(gd);
46395
46414
  }
46396
- if(gd._fullLayout._activeSelectionIndex >= 0) {
46415
+ if(hasActiveSelection(gd)) {
46397
46416
  gd._fullLayout._deactivateSelection(gd);
46398
46417
  }
46399
46418
 
@@ -46421,7 +46440,7 @@ function clearSelectionsCache(dragOptions, immediateSelect) {
46421
46440
  var selections;
46422
46441
  if(
46423
46442
  isSelectMode &&
46424
- !dragOptions.subplot // only allow cartesian - no mapbox for now
46443
+ !hasSubplot(dragOptions) // only allow cartesian - no mapbox for now
46425
46444
  ) {
46426
46445
  selections = newSelections(outlines, dragOptions);
46427
46446
  }
@@ -46460,7 +46479,10 @@ function determineSearchTraces(gd, xAxes, yAxes, subplot) {
46460
46479
 
46461
46480
  if(trace.visible !== true || !trace._module || !trace._module.selectPoints) continue;
46462
46481
 
46463
- if(subplot && (trace.subplot === subplot || trace.geo === subplot)) {
46482
+ if(
46483
+ hasSubplot({subplot: subplot}) &&
46484
+ (trace.subplot === subplot || trace.geo === subplot)
46485
+ ) {
46464
46486
  searchTraces.push(createSearchInfo(trace._module, cd, xAxes[0], yAxes[0]));
46465
46487
  } else if(trace.type === 'splom') {
46466
46488
  // FIXME: make sure we don't have more than single axis for splom
@@ -47215,13 +47237,10 @@ function getFillRangeItems(dragOptions) {
47215
47237
  }
47216
47238
 
47217
47239
  function emitSelecting(gd, eventData) {
47218
- if(drawMode(gd._fullLayout.dragmode)) return;
47219
47240
  gd.emit('plotly_selecting', eventData);
47220
47241
  }
47221
47242
 
47222
47243
  function emitSelected(gd, eventData) {
47223
- if(drawMode(gd._fullLayout.dragmode)) return;
47224
-
47225
47244
  if(eventData) {
47226
47245
  eventData.selections = (gd.layout || {}).selections || [];
47227
47246
  }
@@ -47230,7 +47249,6 @@ function emitSelected(gd, eventData) {
47230
47249
  }
47231
47250
 
47232
47251
  function emitDeselect(gd) {
47233
- if(drawMode(gd._fullLayout.dragmode)) return;
47234
47252
  gd.emit('plotly_deselect', null);
47235
47253
  }
47236
47254
 
@@ -104895,7 +104913,7 @@ function getSortFunc(opts, d2c) {
104895
104913
  'use strict';
104896
104914
 
104897
104915
  // package version injected by `npm run preprocess`
104898
- exports.version = '2.13.1';
104916
+ exports.version = '2.13.2';
104899
104917
 
104900
104918
  },{}]},{},[15])(15)
104901
104919
  });