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 (mapbox) v2.13.1
2
+ * plotly.js (mapbox) v2.13.2
3
3
  * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -83855,7 +83855,14 @@ var p2r = helpers.p2r;
83855
83855
  var axValue = helpers.axValue;
83856
83856
  var getTransform = helpers.getTransform;
83857
83857
 
83858
+ function hasSubplot(dragOptions) {
83859
+ // N.B. subplot may be falsy e.g zero sankey index!
83860
+ return dragOptions.subplot !== undefined;
83861
+ }
83862
+
83858
83863
  function prepSelect(evt, startX, startY, dragOptions, mode) {
83864
+ var isCartesian = !hasSubplot(dragOptions);
83865
+
83859
83866
  var isFreeMode = freeMode(mode);
83860
83867
  var isRectMode = rectMode(mode);
83861
83868
  var isOpenMode = openMode(mode);
@@ -83869,7 +83876,7 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
83869
83876
  var gd = dragOptions.gd;
83870
83877
  var fullLayout = gd._fullLayout;
83871
83878
  var immediateSelect = isSelectMode && fullLayout.newselection.mode === 'immediate' &&
83872
- !dragOptions.subplot; // N.B. only cartesian subplots have persistent selection
83879
+ isCartesian; // N.B. only cartesian subplots have persistent selection
83873
83880
 
83874
83881
  var zoomLayer = fullLayout._zoomlayer;
83875
83882
  var dragBBox = dragOptions.element.getBoundingClientRect();
@@ -83917,9 +83924,9 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
83917
83924
  opacity: isDrawMode ? newStyle.opacity / 2 : 1,
83918
83925
  fill: (isDrawMode && !isOpenMode) ? newStyle.fillcolor : 'none',
83919
83926
  stroke: newStyle.line.color || (
83920
- dragOptions.subplot !== undefined ?
83921
- '#7f7f7f' : // non-cartesian subplot
83922
- Color.contrast(gd._fullLayout.plot_bgcolor) // cartesian subplot
83927
+ isCartesian ?
83928
+ Color.contrast(gd._fullLayout.plot_bgcolor) :
83929
+ '#7f7f7f' // non-cartesian subplot
83923
83930
  ),
83924
83931
  'stroke-dasharray': dashStyle(newStyle.line.dash, newStyle.line.width),
83925
83932
  'stroke-width': newStyle.line.width + 'px',
@@ -83950,6 +83957,8 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
83950
83957
 
83951
83958
  if(immediateSelect && !evt.shiftKey) {
83952
83959
  dragOptions._clearSubplotSelections = function() {
83960
+ if(!isCartesian) return;
83961
+
83953
83962
  var xRef = xAxis._id;
83954
83963
  var yRef = yAxis._id;
83955
83964
  deselectSubplot(gd, xRef, yRef, searchTraces);
@@ -84256,7 +84265,9 @@ function prepSelect(evt, startX, startY, dragOptions, mode) {
84256
84265
  dragOptions.doneFnCompleted(selection);
84257
84266
  }
84258
84267
 
84259
- emitSelected(gd, eventData);
84268
+ if(isSelectMode) {
84269
+ emitSelected(gd, eventData);
84270
+ }
84260
84271
  }).catch(Lib.error);
84261
84272
  };
84262
84273
  }
@@ -84478,15 +84489,23 @@ function coerceSelectionsCache(evt, gd, dragOptions) {
84478
84489
  }
84479
84490
  }
84480
84491
 
84492
+ function hasActiveShape(gd) {
84493
+ return gd._fullLayout._activeShapeIndex >= 0;
84494
+ }
84495
+
84496
+ function hasActiveSelection(gd) {
84497
+ return gd._fullLayout._activeSelectionIndex >= 0;
84498
+ }
84499
+
84481
84500
  function clearSelectionsCache(dragOptions, immediateSelect) {
84482
84501
  var dragmode = dragOptions.dragmode;
84483
84502
  var plotinfo = dragOptions.plotinfo;
84484
84503
 
84485
84504
  var gd = dragOptions.gd;
84486
- if(gd._fullLayout._activeShapeIndex >= 0) {
84505
+ if(hasActiveShape(gd)) {
84487
84506
  gd._fullLayout._deactivateShape(gd);
84488
84507
  }
84489
- if(gd._fullLayout._activeSelectionIndex >= 0) {
84508
+ if(hasActiveSelection(gd)) {
84490
84509
  gd._fullLayout._deactivateSelection(gd);
84491
84510
  }
84492
84511
 
@@ -84514,7 +84533,7 @@ function clearSelectionsCache(dragOptions, immediateSelect) {
84514
84533
  var selections;
84515
84534
  if(
84516
84535
  isSelectMode &&
84517
- !dragOptions.subplot // only allow cartesian - no mapbox for now
84536
+ !hasSubplot(dragOptions) // only allow cartesian - no mapbox for now
84518
84537
  ) {
84519
84538
  selections = newSelections(outlines, dragOptions);
84520
84539
  }
@@ -84553,7 +84572,10 @@ function determineSearchTraces(gd, xAxes, yAxes, subplot) {
84553
84572
 
84554
84573
  if(trace.visible !== true || !trace._module || !trace._module.selectPoints) continue;
84555
84574
 
84556
- if(subplot && (trace.subplot === subplot || trace.geo === subplot)) {
84575
+ if(
84576
+ hasSubplot({subplot: subplot}) &&
84577
+ (trace.subplot === subplot || trace.geo === subplot)
84578
+ ) {
84557
84579
  searchTraces.push(createSearchInfo(trace._module, cd, xAxes[0], yAxes[0]));
84558
84580
  } else if(trace.type === 'splom') {
84559
84581
  // FIXME: make sure we don't have more than single axis for splom
@@ -85308,13 +85330,10 @@ function getFillRangeItems(dragOptions) {
85308
85330
  }
85309
85331
 
85310
85332
  function emitSelecting(gd, eventData) {
85311
- if(drawMode(gd._fullLayout.dragmode)) return;
85312
85333
  gd.emit('plotly_selecting', eventData);
85313
85334
  }
85314
85335
 
85315
85336
  function emitSelected(gd, eventData) {
85316
- if(drawMode(gd._fullLayout.dragmode)) return;
85317
-
85318
85337
  if(eventData) {
85319
85338
  eventData.selections = (gd.layout || {}).selections || [];
85320
85339
  }
@@ -85323,7 +85342,6 @@ function emitSelected(gd, eventData) {
85323
85342
  }
85324
85343
 
85325
85344
  function emitDeselect(gd) {
85326
- if(drawMode(gd._fullLayout.dragmode)) return;
85327
85345
  gd.emit('plotly_deselect', null);
85328
85346
  }
85329
85347
 
@@ -131875,7 +131893,7 @@ function getSortFunc(opts, d2c) {
131875
131893
  'use strict';
131876
131894
 
131877
131895
  // package version injected by `npm run preprocess`
131878
- exports.version = '2.13.1';
131896
+ exports.version = '2.13.2';
131879
131897
 
131880
131898
  },{}]},{},[9])(9)
131881
131899
  });