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 (gl2d) v2.13.1
2
+ * plotly.js (gl2d) v2.13.2
3
3
  * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -50060,7 +50060,14 @@ var p2r = helpers.p2r;
50060
50060
  var axValue = helpers.axValue;
50061
50061
  var getTransform = helpers.getTransform;
50062
50062
 
50063
+ function hasSubplot(dragOptions) {
50064
+ // N.B. subplot may be falsy e.g zero sankey index!
50065
+ return dragOptions.subplot !== undefined;
50066
+ }
50067
+
50063
50068
  function prepSelect(evt, startX, startY, dragOptions, mode) {
50069
+ var isCartesian = !hasSubplot(dragOptions);
50070
+
50064
50071
  var isFreeMode = freeMode(mode);
50065
50072
  var isRectMode = rectMode(mode);
50066
50073
  var isOpenMode = openMode(mode);
@@ -50074,7 +50081,7 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
50074
50081
  var gd = dragOptions.gd;
50075
50082
  var fullLayout = gd._fullLayout;
50076
50083
  var immediateSelect = isSelectMode && fullLayout.newselection.mode === 'immediate' &&
50077
- !dragOptions.subplot; // N.B. only cartesian subplots have persistent selection
50084
+ isCartesian; // N.B. only cartesian subplots have persistent selection
50078
50085
 
50079
50086
  var zoomLayer = fullLayout._zoomlayer;
50080
50087
  var dragBBox = dragOptions.element.getBoundingClientRect();
@@ -50122,9 +50129,9 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
50122
50129
  opacity: isDrawMode ? newStyle.opacity / 2 : 1,
50123
50130
  fill: (isDrawMode && !isOpenMode) ? newStyle.fillcolor : 'none',
50124
50131
  stroke: newStyle.line.color || (
50125
- dragOptions.subplot !== undefined ?
50126
- '#7f7f7f' : // non-cartesian subplot
50127
- Color.contrast(gd._fullLayout.plot_bgcolor) // cartesian subplot
50132
+ isCartesian ?
50133
+ Color.contrast(gd._fullLayout.plot_bgcolor) :
50134
+ '#7f7f7f' // non-cartesian subplot
50128
50135
  ),
50129
50136
  'stroke-dasharray': dashStyle(newStyle.line.dash, newStyle.line.width),
50130
50137
  'stroke-width': newStyle.line.width + 'px',
@@ -50155,6 +50162,8 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
50155
50162
 
50156
50163
  if(immediateSelect && !evt.shiftKey) {
50157
50164
  dragOptions._clearSubplotSelections = function() {
50165
+ if(!isCartesian) return;
50166
+
50158
50167
  var xRef = xAxis._id;
50159
50168
  var yRef = yAxis._id;
50160
50169
  deselectSubplot(gd, xRef, yRef, searchTraces);
@@ -50461,7 +50470,9 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
50461
50470
  dragOptions.doneFnCompleted(selection);
50462
50471
  }
50463
50472
 
50464
- emitSelected(gd, eventData);
50473
+ if(isSelectMode) {
50474
+ emitSelected(gd, eventData);
50475
+ }
50465
50476
  }).catch(Lib.error);
50466
50477
  };
50467
50478
  }
@@ -50683,15 +50694,23 @@ function coerceSelectionsCache(evt, gd, dragOptions) {
50683
50694
  }
50684
50695
  }
50685
50696
 
50697
+ function hasActiveShape(gd) {
50698
+ return gd._fullLayout._activeShapeIndex >= 0;
50699
+ }
50700
+
50701
+ function hasActiveSelection(gd) {
50702
+ return gd._fullLayout._activeSelectionIndex >= 0;
50703
+ }
50704
+
50686
50705
  function clearSelectionsCache(dragOptions, immediateSelect) {
50687
50706
  var dragmode = dragOptions.dragmode;
50688
50707
  var plotinfo = dragOptions.plotinfo;
50689
50708
 
50690
50709
  var gd = dragOptions.gd;
50691
- if(gd._fullLayout._activeShapeIndex >= 0) {
50710
+ if(hasActiveShape(gd)) {
50692
50711
  gd._fullLayout._deactivateShape(gd);
50693
50712
  }
50694
- if(gd._fullLayout._activeSelectionIndex >= 0) {
50713
+ if(hasActiveSelection(gd)) {
50695
50714
  gd._fullLayout._deactivateSelection(gd);
50696
50715
  }
50697
50716
 
@@ -50719,7 +50738,7 @@ function clearSelectionsCache(dragOptions, immediateSelect) {
50719
50738
  var selections;
50720
50739
  if(
50721
50740
  isSelectMode &&
50722
- !dragOptions.subplot // only allow cartesian - no mapbox for now
50741
+ !hasSubplot(dragOptions) // only allow cartesian - no mapbox for now
50723
50742
  ) {
50724
50743
  selections = newSelections(outlines, dragOptions);
50725
50744
  }
@@ -50758,7 +50777,10 @@ function determineSearchTraces(gd, xAxes, yAxes, subplot) {
50758
50777
 
50759
50778
  if(trace.visible !== true || !trace._module || !trace._module.selectPoints) continue;
50760
50779
 
50761
- if(subplot && (trace.subplot === subplot || trace.geo === subplot)) {
50780
+ if(
50781
+ hasSubplot({subplot: subplot}) &&
50782
+ (trace.subplot === subplot || trace.geo === subplot)
50783
+ ) {
50762
50784
  searchTraces.push(createSearchInfo(trace._module, cd, xAxes[0], yAxes[0]));
50763
50785
  } else if(trace.type === 'splom') {
50764
50786
  // FIXME: make sure we don't have more than single axis for splom
@@ -51513,13 +51535,10 @@ function getFillRangeItems(dragOptions) {
51513
51535
  }
51514
51536
 
51515
51537
  function emitSelecting(gd, eventData) {
51516
- if(drawMode(gd._fullLayout.dragmode)) return;
51517
51538
  gd.emit('plotly_selecting', eventData);
51518
51539
  }
51519
51540
 
51520
51541
  function emitSelected(gd, eventData) {
51521
- if(drawMode(gd._fullLayout.dragmode)) return;
51522
-
51523
51542
  if(eventData) {
51524
51543
  eventData.selections = (gd.layout || {}).selections || [];
51525
51544
  }
@@ -51528,7 +51547,6 @@ function emitSelected(gd, eventData) {
51528
51547
  }
51529
51548
 
51530
51549
  function emitDeselect(gd) {
51531
- if(drawMode(gd._fullLayout.dragmode)) return;
51532
51550
  gd.emit('plotly_deselect', null);
51533
51551
  }
51534
51552
 
@@ -103014,7 +103032,7 @@ function getSortFunc(opts, d2c) {
103014
103032
  'use strict';
103015
103033
 
103016
103034
  // package version injected by `npm run preprocess`
103017
- exports.version = '2.13.1';
103035
+ exports.version = '2.13.2';
103018
103036
 
103019
103037
  },{}],600:[function(_dereq_,module,exports){
103020
103038
  (function (global){(function (){