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 (finance) v2.13.1
2
+ * plotly.js (finance) v2.13.2
3
3
  * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -37812,7 +37812,14 @@ var p2r = helpers.p2r;
37812
37812
  var axValue = helpers.axValue;
37813
37813
  var getTransform = helpers.getTransform;
37814
37814
 
37815
+ function hasSubplot(dragOptions) {
37816
+ // N.B. subplot may be falsy e.g zero sankey index!
37817
+ return dragOptions.subplot !== undefined;
37818
+ }
37819
+
37815
37820
  function prepSelect(evt, startX, startY, dragOptions, mode) {
37821
+ var isCartesian = !hasSubplot(dragOptions);
37822
+
37816
37823
  var isFreeMode = freeMode(mode);
37817
37824
  var isRectMode = rectMode(mode);
37818
37825
  var isOpenMode = openMode(mode);
@@ -37826,7 +37833,7 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
37826
37833
  var gd = dragOptions.gd;
37827
37834
  var fullLayout = gd._fullLayout;
37828
37835
  var immediateSelect = isSelectMode && fullLayout.newselection.mode === 'immediate' &&
37829
- !dragOptions.subplot; // N.B. only cartesian subplots have persistent selection
37836
+ isCartesian; // N.B. only cartesian subplots have persistent selection
37830
37837
 
37831
37838
  var zoomLayer = fullLayout._zoomlayer;
37832
37839
  var dragBBox = dragOptions.element.getBoundingClientRect();
@@ -37874,9 +37881,9 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
37874
37881
  opacity: isDrawMode ? newStyle.opacity / 2 : 1,
37875
37882
  fill: (isDrawMode && !isOpenMode) ? newStyle.fillcolor : 'none',
37876
37883
  stroke: newStyle.line.color || (
37877
- dragOptions.subplot !== undefined ?
37878
- '#7f7f7f' : // non-cartesian subplot
37879
- Color.contrast(gd._fullLayout.plot_bgcolor) // cartesian subplot
37884
+ isCartesian ?
37885
+ Color.contrast(gd._fullLayout.plot_bgcolor) :
37886
+ '#7f7f7f' // non-cartesian subplot
37880
37887
  ),
37881
37888
  'stroke-dasharray': dashStyle(newStyle.line.dash, newStyle.line.width),
37882
37889
  'stroke-width': newStyle.line.width + 'px',
@@ -37907,6 +37914,8 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
37907
37914
 
37908
37915
  if(immediateSelect && !evt.shiftKey) {
37909
37916
  dragOptions._clearSubplotSelections = function() {
37917
+ if(!isCartesian) return;
37918
+
37910
37919
  var xRef = xAxis._id;
37911
37920
  var yRef = yAxis._id;
37912
37921
  deselectSubplot(gd, xRef, yRef, searchTraces);
@@ -38213,7 +38222,9 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
38213
38222
  dragOptions.doneFnCompleted(selection);
38214
38223
  }
38215
38224
 
38216
- emitSelected(gd, eventData);
38225
+ if(isSelectMode) {
38226
+ emitSelected(gd, eventData);
38227
+ }
38217
38228
  }).catch(Lib.error);
38218
38229
  };
38219
38230
  }
@@ -38435,15 +38446,23 @@ function coerceSelectionsCache(evt, gd, dragOptions) {
38435
38446
  }
38436
38447
  }
38437
38448
 
38449
+ function hasActiveShape(gd) {
38450
+ return gd._fullLayout._activeShapeIndex >= 0;
38451
+ }
38452
+
38453
+ function hasActiveSelection(gd) {
38454
+ return gd._fullLayout._activeSelectionIndex >= 0;
38455
+ }
38456
+
38438
38457
  function clearSelectionsCache(dragOptions, immediateSelect) {
38439
38458
  var dragmode = dragOptions.dragmode;
38440
38459
  var plotinfo = dragOptions.plotinfo;
38441
38460
 
38442
38461
  var gd = dragOptions.gd;
38443
- if(gd._fullLayout._activeShapeIndex >= 0) {
38462
+ if(hasActiveShape(gd)) {
38444
38463
  gd._fullLayout._deactivateShape(gd);
38445
38464
  }
38446
- if(gd._fullLayout._activeSelectionIndex >= 0) {
38465
+ if(hasActiveSelection(gd)) {
38447
38466
  gd._fullLayout._deactivateSelection(gd);
38448
38467
  }
38449
38468
 
@@ -38471,7 +38490,7 @@ function clearSelectionsCache(dragOptions, immediateSelect) {
38471
38490
  var selections;
38472
38491
  if(
38473
38492
  isSelectMode &&
38474
- !dragOptions.subplot // only allow cartesian - no mapbox for now
38493
+ !hasSubplot(dragOptions) // only allow cartesian - no mapbox for now
38475
38494
  ) {
38476
38495
  selections = newSelections(outlines, dragOptions);
38477
38496
  }
@@ -38510,7 +38529,10 @@ function determineSearchTraces(gd, xAxes, yAxes, subplot) {
38510
38529
 
38511
38530
  if(trace.visible !== true || !trace._module || !trace._module.selectPoints) continue;
38512
38531
 
38513
- if(subplot && (trace.subplot === subplot || trace.geo === subplot)) {
38532
+ if(
38533
+ hasSubplot({subplot: subplot}) &&
38534
+ (trace.subplot === subplot || trace.geo === subplot)
38535
+ ) {
38514
38536
  searchTraces.push(createSearchInfo(trace._module, cd, xAxes[0], yAxes[0]));
38515
38537
  } else if(trace.type === 'splom') {
38516
38538
  // FIXME: make sure we don't have more than single axis for splom
@@ -39265,13 +39287,10 @@ function getFillRangeItems(dragOptions) {
39265
39287
  }
39266
39288
 
39267
39289
  function emitSelecting(gd, eventData) {
39268
- if(drawMode(gd._fullLayout.dragmode)) return;
39269
39290
  gd.emit('plotly_selecting', eventData);
39270
39291
  }
39271
39292
 
39272
39293
  function emitSelected(gd, eventData) {
39273
- if(drawMode(gd._fullLayout.dragmode)) return;
39274
-
39275
39294
  if(eventData) {
39276
39295
  eventData.selections = (gd.layout || {}).selections || [];
39277
39296
  }
@@ -39280,7 +39299,6 @@ function emitSelected(gd, eventData) {
39280
39299
  }
39281
39300
 
39282
39301
  function emitDeselect(gd) {
39283
- if(drawMode(gd._fullLayout.dragmode)) return;
39284
39302
  gd.emit('plotly_deselect', null);
39285
39303
  }
39286
39304
 
@@ -92673,7 +92691,7 @@ function getSortFunc(opts, d2c) {
92673
92691
  'use strict';
92674
92692
 
92675
92693
  // package version injected by `npm run preprocess`
92676
- exports.version = '2.13.1';
92694
+ exports.version = '2.13.2';
92677
92695
 
92678
92696
  },{}]},{},[12])(12)
92679
92697
  });