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 v2.13.1
2
+ * plotly.js v2.13.2
3
3
  * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -122005,7 +122005,14 @@ var p2r = helpers.p2r;
122005
122005
  var axValue = helpers.axValue;
122006
122006
  var getTransform = helpers.getTransform;
122007
122007
 
122008
+ function hasSubplot(dragOptions) {
122009
+ // N.B. subplot may be falsy e.g zero sankey index!
122010
+ return dragOptions.subplot !== undefined;
122011
+ }
122012
+
122008
122013
  function prepSelect(evt, startX, startY, dragOptions, mode) {
122014
+ var isCartesian = !hasSubplot(dragOptions);
122015
+
122009
122016
  var isFreeMode = freeMode(mode);
122010
122017
  var isRectMode = rectMode(mode);
122011
122018
  var isOpenMode = openMode(mode);
@@ -122019,7 +122026,7 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
122019
122026
  var gd = dragOptions.gd;
122020
122027
  var fullLayout = gd._fullLayout;
122021
122028
  var immediateSelect = isSelectMode && fullLayout.newselection.mode === 'immediate' &&
122022
- !dragOptions.subplot; // N.B. only cartesian subplots have persistent selection
122029
+ isCartesian; // N.B. only cartesian subplots have persistent selection
122023
122030
 
122024
122031
  var zoomLayer = fullLayout._zoomlayer;
122025
122032
  var dragBBox = dragOptions.element.getBoundingClientRect();
@@ -122067,9 +122074,9 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
122067
122074
  opacity: isDrawMode ? newStyle.opacity / 2 : 1,
122068
122075
  fill: (isDrawMode && !isOpenMode) ? newStyle.fillcolor : 'none',
122069
122076
  stroke: newStyle.line.color || (
122070
- dragOptions.subplot !== undefined ?
122071
- '#7f7f7f' : // non-cartesian subplot
122072
- Color.contrast(gd._fullLayout.plot_bgcolor) // cartesian subplot
122077
+ isCartesian ?
122078
+ Color.contrast(gd._fullLayout.plot_bgcolor) :
122079
+ '#7f7f7f' // non-cartesian subplot
122073
122080
  ),
122074
122081
  'stroke-dasharray': dashStyle(newStyle.line.dash, newStyle.line.width),
122075
122082
  'stroke-width': newStyle.line.width + 'px',
@@ -122100,6 +122107,8 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
122100
122107
 
122101
122108
  if(immediateSelect && !evt.shiftKey) {
122102
122109
  dragOptions._clearSubplotSelections = function() {
122110
+ if(!isCartesian) return;
122111
+
122103
122112
  var xRef = xAxis._id;
122104
122113
  var yRef = yAxis._id;
122105
122114
  deselectSubplot(gd, xRef, yRef, searchTraces);
@@ -122406,7 +122415,9 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
122406
122415
  dragOptions.doneFnCompleted(selection);
122407
122416
  }
122408
122417
 
122409
- emitSelected(gd, eventData);
122418
+ if(isSelectMode) {
122419
+ emitSelected(gd, eventData);
122420
+ }
122410
122421
  }).catch(Lib.error);
122411
122422
  };
122412
122423
  }
@@ -122628,15 +122639,23 @@ function coerceSelectionsCache(evt, gd, dragOptions) {
122628
122639
  }
122629
122640
  }
122630
122641
 
122642
+ function hasActiveShape(gd) {
122643
+ return gd._fullLayout._activeShapeIndex >= 0;
122644
+ }
122645
+
122646
+ function hasActiveSelection(gd) {
122647
+ return gd._fullLayout._activeSelectionIndex >= 0;
122648
+ }
122649
+
122631
122650
  function clearSelectionsCache(dragOptions, immediateSelect) {
122632
122651
  var dragmode = dragOptions.dragmode;
122633
122652
  var plotinfo = dragOptions.plotinfo;
122634
122653
 
122635
122654
  var gd = dragOptions.gd;
122636
- if(gd._fullLayout._activeShapeIndex >= 0) {
122655
+ if(hasActiveShape(gd)) {
122637
122656
  gd._fullLayout._deactivateShape(gd);
122638
122657
  }
122639
- if(gd._fullLayout._activeSelectionIndex >= 0) {
122658
+ if(hasActiveSelection(gd)) {
122640
122659
  gd._fullLayout._deactivateSelection(gd);
122641
122660
  }
122642
122661
 
@@ -122664,7 +122683,7 @@ function clearSelectionsCache(dragOptions, immediateSelect) {
122664
122683
  var selections;
122665
122684
  if(
122666
122685
  isSelectMode &&
122667
- !dragOptions.subplot // only allow cartesian - no mapbox for now
122686
+ !hasSubplot(dragOptions) // only allow cartesian - no mapbox for now
122668
122687
  ) {
122669
122688
  selections = newSelections(outlines, dragOptions);
122670
122689
  }
@@ -122703,7 +122722,10 @@ function determineSearchTraces(gd, xAxes, yAxes, subplot) {
122703
122722
 
122704
122723
  if(trace.visible !== true || !trace._module || !trace._module.selectPoints) continue;
122705
122724
 
122706
- if(subplot && (trace.subplot === subplot || trace.geo === subplot)) {
122725
+ if(
122726
+ hasSubplot({subplot: subplot}) &&
122727
+ (trace.subplot === subplot || trace.geo === subplot)
122728
+ ) {
122707
122729
  searchTraces.push(createSearchInfo(trace._module, cd, xAxes[0], yAxes[0]));
122708
122730
  } else if(trace.type === 'splom') {
122709
122731
  // FIXME: make sure we don't have more than single axis for splom
@@ -123458,13 +123480,10 @@ function getFillRangeItems(dragOptions) {
123458
123480
  }
123459
123481
 
123460
123482
  function emitSelecting(gd, eventData) {
123461
- if(drawMode(gd._fullLayout.dragmode)) return;
123462
123483
  gd.emit('plotly_selecting', eventData);
123463
123484
  }
123464
123485
 
123465
123486
  function emitSelected(gd, eventData) {
123466
- if(drawMode(gd._fullLayout.dragmode)) return;
123467
-
123468
123487
  if(eventData) {
123469
123488
  eventData.selections = (gd.layout || {}).selections || [];
123470
123489
  }
@@ -123473,7 +123492,6 @@ function emitSelected(gd, eventData) {
123473
123492
  }
123474
123493
 
123475
123494
  function emitDeselect(gd) {
123476
- if(drawMode(gd._fullLayout.dragmode)) return;
123477
123495
  gd.emit('plotly_deselect', null);
123478
123496
  }
123479
123497
 
@@ -209680,6 +209698,7 @@ function subplotUpdateFx(gd, index) {
209680
209698
  var dragMode = fullLayout.dragmode;
209681
209699
  var cursor = fullLayout.dragmode === 'pan' ? 'move' : 'crosshair';
209682
209700
  var bgRect = trace._bgRect;
209701
+ if(!bgRect) return;
209683
209702
 
209684
209703
  if(dragMode === 'pan' || dragMode === 'zoom') return;
209685
209704
 
@@ -232759,7 +232778,7 @@ function getSortFunc(opts, d2c) {
232759
232778
  'use strict';
232760
232779
 
232761
232780
  // package version injected by `npm run preprocess`
232762
- exports.version = '2.13.1';
232781
+ exports.version = '2.13.2';
232763
232782
 
232764
232783
  },{}],1133:[function(_dereq_,module,exports){
232765
232784
  (function (global){(function (){
package/dist/plotly.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * plotly.js v2.13.1
2
+ * plotly.js v2.13.2
3
3
  * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -121056,7 +121056,14 @@ var p2r = helpers.p2r;
121056
121056
  var axValue = helpers.axValue;
121057
121057
  var getTransform = helpers.getTransform;
121058
121058
 
121059
+ function hasSubplot(dragOptions) {
121060
+ // N.B. subplot may be falsy e.g zero sankey index!
121061
+ return dragOptions.subplot !== undefined;
121062
+ }
121063
+
121059
121064
  function prepSelect(evt, startX, startY, dragOptions, mode) {
121065
+ var isCartesian = !hasSubplot(dragOptions);
121066
+
121060
121067
  var isFreeMode = freeMode(mode);
121061
121068
  var isRectMode = rectMode(mode);
121062
121069
  var isOpenMode = openMode(mode);
@@ -121070,7 +121077,7 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
121070
121077
  var gd = dragOptions.gd;
121071
121078
  var fullLayout = gd._fullLayout;
121072
121079
  var immediateSelect = isSelectMode && fullLayout.newselection.mode === 'immediate' &&
121073
- !dragOptions.subplot; // N.B. only cartesian subplots have persistent selection
121080
+ isCartesian; // N.B. only cartesian subplots have persistent selection
121074
121081
 
121075
121082
  var zoomLayer = fullLayout._zoomlayer;
121076
121083
  var dragBBox = dragOptions.element.getBoundingClientRect();
@@ -121118,9 +121125,9 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
121118
121125
  opacity: isDrawMode ? newStyle.opacity / 2 : 1,
121119
121126
  fill: (isDrawMode && !isOpenMode) ? newStyle.fillcolor : 'none',
121120
121127
  stroke: newStyle.line.color || (
121121
- dragOptions.subplot !== undefined ?
121122
- '#7f7f7f' : // non-cartesian subplot
121123
- Color.contrast(gd._fullLayout.plot_bgcolor) // cartesian subplot
121128
+ isCartesian ?
121129
+ Color.contrast(gd._fullLayout.plot_bgcolor) :
121130
+ '#7f7f7f' // non-cartesian subplot
121124
121131
  ),
121125
121132
  'stroke-dasharray': dashStyle(newStyle.line.dash, newStyle.line.width),
121126
121133
  'stroke-width': newStyle.line.width + 'px',
@@ -121151,6 +121158,8 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
121151
121158
 
121152
121159
  if(immediateSelect && !evt.shiftKey) {
121153
121160
  dragOptions._clearSubplotSelections = function() {
121161
+ if(!isCartesian) return;
121162
+
121154
121163
  var xRef = xAxis._id;
121155
121164
  var yRef = yAxis._id;
121156
121165
  deselectSubplot(gd, xRef, yRef, searchTraces);
@@ -121457,7 +121466,9 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
121457
121466
  dragOptions.doneFnCompleted(selection);
121458
121467
  }
121459
121468
 
121460
- emitSelected(gd, eventData);
121469
+ if(isSelectMode) {
121470
+ emitSelected(gd, eventData);
121471
+ }
121461
121472
  }).catch(Lib.error);
121462
121473
  };
121463
121474
  }
@@ -121679,15 +121690,23 @@ function coerceSelectionsCache(evt, gd, dragOptions) {
121679
121690
  }
121680
121691
  }
121681
121692
 
121693
+ function hasActiveShape(gd) {
121694
+ return gd._fullLayout._activeShapeIndex >= 0;
121695
+ }
121696
+
121697
+ function hasActiveSelection(gd) {
121698
+ return gd._fullLayout._activeSelectionIndex >= 0;
121699
+ }
121700
+
121682
121701
  function clearSelectionsCache(dragOptions, immediateSelect) {
121683
121702
  var dragmode = dragOptions.dragmode;
121684
121703
  var plotinfo = dragOptions.plotinfo;
121685
121704
 
121686
121705
  var gd = dragOptions.gd;
121687
- if(gd._fullLayout._activeShapeIndex >= 0) {
121706
+ if(hasActiveShape(gd)) {
121688
121707
  gd._fullLayout._deactivateShape(gd);
121689
121708
  }
121690
- if(gd._fullLayout._activeSelectionIndex >= 0) {
121709
+ if(hasActiveSelection(gd)) {
121691
121710
  gd._fullLayout._deactivateSelection(gd);
121692
121711
  }
121693
121712
 
@@ -121715,7 +121734,7 @@ function clearSelectionsCache(dragOptions, immediateSelect) {
121715
121734
  var selections;
121716
121735
  if(
121717
121736
  isSelectMode &&
121718
- !dragOptions.subplot // only allow cartesian - no mapbox for now
121737
+ !hasSubplot(dragOptions) // only allow cartesian - no mapbox for now
121719
121738
  ) {
121720
121739
  selections = newSelections(outlines, dragOptions);
121721
121740
  }
@@ -121754,7 +121773,10 @@ function determineSearchTraces(gd, xAxes, yAxes, subplot) {
121754
121773
 
121755
121774
  if(trace.visible !== true || !trace._module || !trace._module.selectPoints) continue;
121756
121775
 
121757
- if(subplot && (trace.subplot === subplot || trace.geo === subplot)) {
121776
+ if(
121777
+ hasSubplot({subplot: subplot}) &&
121778
+ (trace.subplot === subplot || trace.geo === subplot)
121779
+ ) {
121758
121780
  searchTraces.push(createSearchInfo(trace._module, cd, xAxes[0], yAxes[0]));
121759
121781
  } else if(trace.type === 'splom') {
121760
121782
  // FIXME: make sure we don't have more than single axis for splom
@@ -122509,13 +122531,10 @@ function getFillRangeItems(dragOptions) {
122509
122531
  }
122510
122532
 
122511
122533
  function emitSelecting(gd, eventData) {
122512
- if(drawMode(gd._fullLayout.dragmode)) return;
122513
122534
  gd.emit('plotly_selecting', eventData);
122514
122535
  }
122515
122536
 
122516
122537
  function emitSelected(gd, eventData) {
122517
- if(drawMode(gd._fullLayout.dragmode)) return;
122518
-
122519
122538
  if(eventData) {
122520
122539
  eventData.selections = (gd.layout || {}).selections || [];
122521
122540
  }
@@ -122524,7 +122543,6 @@ function emitSelected(gd, eventData) {
122524
122543
  }
122525
122544
 
122526
122545
  function emitDeselect(gd) {
122527
- if(drawMode(gd._fullLayout.dragmode)) return;
122528
122546
  gd.emit('plotly_deselect', null);
122529
122547
  }
122530
122548
 
@@ -204572,6 +204590,7 @@ function subplotUpdateFx(gd, index) {
204572
204590
  var dragMode = fullLayout.dragmode;
204573
204591
  var cursor = fullLayout.dragmode === 'pan' ? 'move' : 'crosshair';
204574
204592
  var bgRect = trace._bgRect;
204593
+ if(!bgRect) return;
204575
204594
 
204576
204595
  if(dragMode === 'pan' || dragMode === 'zoom') return;
204577
204596
 
@@ -226279,7 +226298,7 @@ function getSortFunc(opts, d2c) {
226279
226298
  'use strict';
226280
226299
 
226281
226300
  // package version injected by `npm run preprocess`
226282
- exports.version = '2.13.1';
226301
+ exports.version = '2.13.2';
226283
226302
 
226284
226303
  },{}],1133:[function(_dereq_,module,exports){
226285
226304
  (function (global){(function (){