plotly.js 2.6.4 → 2.7.0

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.6.4
2
+ * plotly.js (mapbox) v2.7.0
3
3
  * Copyright 2012-2021, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -98905,7 +98905,8 @@ function findUIPattern(key, patternSpecs) {
98905
98905
  var spec = patternSpecs[i];
98906
98906
  var match = key.match(spec.pattern);
98907
98907
  if(match) {
98908
- return {head: match[1], attr: spec.attr};
98908
+ var head = match[1] || '';
98909
+ return {head: head, tail: key.substr(head.length + 1), attr: spec.attr};
98909
98910
  }
98910
98911
  }
98911
98912
  }
@@ -98957,26 +98958,54 @@ function valsMatch(v1, v2) {
98957
98958
 
98958
98959
  function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
98959
98960
  var layoutPreGUI = oldFullLayout._preGUI;
98960
- var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal;
98961
+ var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal, head, tail;
98961
98962
  var bothInheritAutorange = [];
98963
+ var newAutorangeIn = {};
98962
98964
  var newRangeAccepted = {};
98963
98965
  for(key in layoutPreGUI) {
98964
98966
  match = findUIPattern(key, layoutUIControlPatterns);
98965
98967
  if(match) {
98966
- revAttr = match.attr || (match.head + '.uirevision');
98968
+ head = match.head;
98969
+ tail = match.tail;
98970
+ revAttr = match.attr || (head + '.uirevision');
98967
98971
  oldRev = nestedProperty(oldFullLayout, revAttr).get();
98968
98972
  newRev = oldRev && getNewRev(revAttr, layout);
98973
+
98969
98974
  if(newRev && (newRev === oldRev)) {
98970
98975
  preGUIVal = layoutPreGUI[key];
98971
98976
  if(preGUIVal === null) preGUIVal = undefined;
98972
98977
  newNP = nestedProperty(layout, key);
98973
98978
  newVal = newNP.get();
98979
+
98974
98980
  if(valsMatch(newVal, preGUIVal)) {
98975
- if(newVal === undefined && key.substr(key.length - 9) === 'autorange') {
98976
- bothInheritAutorange.push(key.substr(0, key.length - 10));
98981
+ if(newVal === undefined && tail === 'autorange') {
98982
+ bothInheritAutorange.push(head);
98977
98983
  }
98978
98984
  newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));
98979
98985
  continue;
98986
+ } else if(tail === 'autorange' || tail.substr(0, 6) === 'range[') {
98987
+ // Special case for (auto)range since we push it back into the layout
98988
+ // so all null should be treated equivalently to autorange: true with any range
98989
+ var pre0 = layoutPreGUI[head + '.range[0]'];
98990
+ var pre1 = layoutPreGUI[head + '.range[1]'];
98991
+ var preAuto = layoutPreGUI[head + '.autorange'];
98992
+ if(preAuto || (preAuto === null && pre0 === null && pre1 === null)) {
98993
+ // Only read the input layout once and stash the result,
98994
+ // so we get it before we start modifying it
98995
+ if(!(head in newAutorangeIn)) {
98996
+ var newContainer = nestedProperty(layout, head).get();
98997
+ newAutorangeIn[head] = newContainer && (
98998
+ newContainer.autorange ||
98999
+ (newContainer.autorange !== false && (
99000
+ !newContainer.range || newContainer.range.length !== 2)
99001
+ )
99002
+ );
99003
+ }
99004
+ if(newAutorangeIn[head]) {
99005
+ newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));
99006
+ continue;
99007
+ }
99008
+ }
98980
99009
  }
98981
99010
  }
98982
99011
  } else {
@@ -98987,12 +99016,12 @@ function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
98987
99016
  // so remove it from _preGUI for next time.
98988
99017
  delete layoutPreGUI[key];
98989
99018
 
98990
- if(key.substr(key.length - 8, 6) === 'range[') {
98991
- newRangeAccepted[key.substr(0, key.length - 9)] = 1;
99019
+ if(match && match.tail.substr(0, 6) === 'range[') {
99020
+ newRangeAccepted[match.head] = 1;
98992
99021
  }
98993
99022
  }
98994
99023
 
98995
- // Special logic for `autorange`, since it interacts with `range`:
99024
+ // More special logic for `autorange`, since it interacts with `range`:
98996
99025
  // If the new figure's matching `range` was kept, and `autorange`
98997
99026
  // wasn't supplied explicitly in either the original or the new figure,
98998
99027
  // we shouldn't alter that - but we may just have done that, so fix it.
@@ -118364,11 +118393,14 @@ proto.project = function(v) {
118364
118393
  proto.getView = function() {
118365
118394
  var map = this.map;
118366
118395
  var mapCenter = map.getCenter();
118367
- var center = { lon: mapCenter.lng, lat: mapCenter.lat };
118396
+ var lon = mapCenter.lng;
118397
+ var lat = mapCenter.lat;
118398
+ var center = { lon: lon, lat: lat };
118368
118399
 
118369
118400
  var canvas = map.getCanvas();
118370
- var w = canvas.width;
118371
- var h = canvas.height;
118401
+ var w = parseInt(canvas.style.width);
118402
+ var h = parseInt(canvas.style.height);
118403
+
118372
118404
  return {
118373
118405
  center: center,
118374
118406
  zoom: map.getZoom(),
@@ -129505,7 +129537,7 @@ function getSortFunc(opts, d2c) {
129505
129537
  'use strict';
129506
129538
 
129507
129539
  // package version injected by `npm run preprocess`
129508
- exports.version = '2.6.4';
129540
+ exports.version = '2.7.0';
129509
129541
 
129510
129542
  },{}]},{},[9])(9)
129511
129543
  });