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 (strict) v2.13.1
2
+ * plotly.js (strict) v2.13.2
3
3
  * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -121036,7 +121036,14 @@ var p2r = helpers.p2r;
121036
121036
  var axValue = helpers.axValue;
121037
121037
  var getTransform = helpers.getTransform;
121038
121038
 
121039
+ function hasSubplot(dragOptions) {
121040
+ // N.B. subplot may be falsy e.g zero sankey index!
121041
+ return dragOptions.subplot !== undefined;
121042
+ }
121043
+
121039
121044
  function prepSelect(evt, startX, startY, dragOptions, mode) {
121045
+ var isCartesian = !hasSubplot(dragOptions);
121046
+
121040
121047
  var isFreeMode = freeMode(mode);
121041
121048
  var isRectMode = rectMode(mode);
121042
121049
  var isOpenMode = openMode(mode);
@@ -121050,7 +121057,7 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
121050
121057
  var gd = dragOptions.gd;
121051
121058
  var fullLayout = gd._fullLayout;
121052
121059
  var immediateSelect = isSelectMode && fullLayout.newselection.mode === 'immediate' &&
121053
- !dragOptions.subplot; // N.B. only cartesian subplots have persistent selection
121060
+ isCartesian; // N.B. only cartesian subplots have persistent selection
121054
121061
 
121055
121062
  var zoomLayer = fullLayout._zoomlayer;
121056
121063
  var dragBBox = dragOptions.element.getBoundingClientRect();
@@ -121098,9 +121105,9 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
121098
121105
  opacity: isDrawMode ? newStyle.opacity / 2 : 1,
121099
121106
  fill: (isDrawMode && !isOpenMode) ? newStyle.fillcolor : 'none',
121100
121107
  stroke: newStyle.line.color || (
121101
- dragOptions.subplot !== undefined ?
121102
- '#7f7f7f' : // non-cartesian subplot
121103
- Color.contrast(gd._fullLayout.plot_bgcolor) // cartesian subplot
121108
+ isCartesian ?
121109
+ Color.contrast(gd._fullLayout.plot_bgcolor) :
121110
+ '#7f7f7f' // non-cartesian subplot
121104
121111
  ),
121105
121112
  'stroke-dasharray': dashStyle(newStyle.line.dash, newStyle.line.width),
121106
121113
  'stroke-width': newStyle.line.width + 'px',
@@ -121131,6 +121138,8 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
121131
121138
 
121132
121139
  if(immediateSelect && !evt.shiftKey) {
121133
121140
  dragOptions._clearSubplotSelections = function() {
121141
+ if(!isCartesian) return;
121142
+
121134
121143
  var xRef = xAxis._id;
121135
121144
  var yRef = yAxis._id;
121136
121145
  deselectSubplot(gd, xRef, yRef, searchTraces);
@@ -121437,7 +121446,9 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
121437
121446
  dragOptions.doneFnCompleted(selection);
121438
121447
  }
121439
121448
 
121440
- emitSelected(gd, eventData);
121449
+ if(isSelectMode) {
121450
+ emitSelected(gd, eventData);
121451
+ }
121441
121452
  }).catch(Lib.error);
121442
121453
  };
121443
121454
  }
@@ -121659,15 +121670,23 @@ function coerceSelectionsCache(evt, gd, dragOptions) {
121659
121670
  }
121660
121671
  }
121661
121672
 
121673
+ function hasActiveShape(gd) {
121674
+ return gd._fullLayout._activeShapeIndex >= 0;
121675
+ }
121676
+
121677
+ function hasActiveSelection(gd) {
121678
+ return gd._fullLayout._activeSelectionIndex >= 0;
121679
+ }
121680
+
121662
121681
  function clearSelectionsCache(dragOptions, immediateSelect) {
121663
121682
  var dragmode = dragOptions.dragmode;
121664
121683
  var plotinfo = dragOptions.plotinfo;
121665
121684
 
121666
121685
  var gd = dragOptions.gd;
121667
- if(gd._fullLayout._activeShapeIndex >= 0) {
121686
+ if(hasActiveShape(gd)) {
121668
121687
  gd._fullLayout._deactivateShape(gd);
121669
121688
  }
121670
- if(gd._fullLayout._activeSelectionIndex >= 0) {
121689
+ if(hasActiveSelection(gd)) {
121671
121690
  gd._fullLayout._deactivateSelection(gd);
121672
121691
  }
121673
121692
 
@@ -121695,7 +121714,7 @@ function clearSelectionsCache(dragOptions, immediateSelect) {
121695
121714
  var selections;
121696
121715
  if(
121697
121716
  isSelectMode &&
121698
- !dragOptions.subplot // only allow cartesian - no mapbox for now
121717
+ !hasSubplot(dragOptions) // only allow cartesian - no mapbox for now
121699
121718
  ) {
121700
121719
  selections = newSelections(outlines, dragOptions);
121701
121720
  }
@@ -121734,7 +121753,10 @@ function determineSearchTraces(gd, xAxes, yAxes, subplot) {
121734
121753
 
121735
121754
  if(trace.visible !== true || !trace._module || !trace._module.selectPoints) continue;
121736
121755
 
121737
- if(subplot && (trace.subplot === subplot || trace.geo === subplot)) {
121756
+ if(
121757
+ hasSubplot({subplot: subplot}) &&
121758
+ (trace.subplot === subplot || trace.geo === subplot)
121759
+ ) {
121738
121760
  searchTraces.push(createSearchInfo(trace._module, cd, xAxes[0], yAxes[0]));
121739
121761
  } else if(trace.type === 'splom') {
121740
121762
  // FIXME: make sure we don't have more than single axis for splom
@@ -122489,13 +122511,10 @@ function getFillRangeItems(dragOptions) {
122489
122511
  }
122490
122512
 
122491
122513
  function emitSelecting(gd, eventData) {
122492
- if(drawMode(gd._fullLayout.dragmode)) return;
122493
122514
  gd.emit('plotly_selecting', eventData);
122494
122515
  }
122495
122516
 
122496
122517
  function emitSelected(gd, eventData) {
122497
- if(drawMode(gd._fullLayout.dragmode)) return;
122498
-
122499
122518
  if(eventData) {
122500
122519
  eventData.selections = (gd.layout || {}).selections || [];
122501
122520
  }
@@ -122504,7 +122523,6 @@ function emitSelected(gd, eventData) {
122504
122523
  }
122505
122524
 
122506
122525
  function emitDeselect(gd) {
122507
- if(drawMode(gd._fullLayout.dragmode)) return;
122508
122526
  gd.emit('plotly_deselect', null);
122509
122527
  }
122510
122528
 
@@ -227519,6 +227537,7 @@ function subplotUpdateFx(gd, index) {
227519
227537
  var dragMode = fullLayout.dragmode;
227520
227538
  var cursor = fullLayout.dragmode === 'pan' ? 'move' : 'crosshair';
227521
227539
  var bgRect = trace._bgRect;
227540
+ if(!bgRect) return;
227522
227541
 
227523
227542
  if(dragMode === 'pan' || dragMode === 'zoom') return;
227524
227543
 
@@ -249315,7 +249334,7 @@ function getSortFunc(opts, d2c) {
249315
249334
  'use strict';
249316
249335
 
249317
249336
  // package version injected by `npm run preprocess`
249318
- exports.version = '2.13.1';
249337
+ exports.version = '2.13.2';
249319
249338
 
249320
249339
  },{}],1151:[function(_dereq_,module,exports){
249321
249340
  (function (global){(function (){