plotly.js 2.6.1 → 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.1
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
@@ -69226,6 +69226,19 @@ function makeColorBarData(gd) {
69226
69226
  }
69227
69227
 
69228
69228
  function drawColorBar(g, opts, gd) {
69229
+ var len = opts.len;
69230
+ var lenmode = opts.lenmode;
69231
+ var thickness = opts.thickness;
69232
+ var thicknessmode = opts.thicknessmode;
69233
+ var outlinewidth = opts.outlinewidth;
69234
+ var borderwidth = opts.borderwidth;
69235
+ var xanchor = opts.xanchor;
69236
+ var yanchor = opts.yanchor;
69237
+ var xpad = opts.xpad;
69238
+ var ypad = opts.ypad;
69239
+ var optsX = opts.x;
69240
+ var optsY = opts.y;
69241
+
69229
69242
  var fullLayout = gd._fullLayout;
69230
69243
  var gs = fullLayout._size;
69231
69244
 
@@ -69255,42 +69268,41 @@ function drawColorBar(g, opts, gd) {
69255
69268
  // when the colorbar itself is pushing the margins.
69256
69269
  // but then the fractional size is calculated based on the
69257
69270
  // actual graph size, so that the axes will size correctly.
69258
- var thickPx = Math.round(opts.thickness * (opts.thicknessmode === 'fraction' ? gs.w : 1));
69271
+ var thickPx = Math.round(thickness * (thicknessmode === 'fraction' ? gs.w : 1));
69259
69272
  var thickFrac = thickPx / gs.w;
69260
- var lenPx = Math.round(opts.len * (opts.lenmode === 'fraction' ? gs.h : 1));
69273
+ var lenPx = Math.round(len * (lenmode === 'fraction' ? gs.h : 1));
69261
69274
  var lenFrac = lenPx / gs.h;
69262
- var xpadFrac = opts.xpad / gs.w;
69263
- var yExtraPx = (opts.borderwidth + opts.outlinewidth) / 2;
69264
- var ypadFrac = opts.ypad / gs.h;
69275
+ var xpadFrac = xpad / gs.w;
69276
+ var yExtraPx = (borderwidth + outlinewidth) / 2;
69277
+ var ypadFrac = ypad / gs.h;
69265
69278
 
69266
69279
  // x positioning: do it initially just for left anchor,
69267
69280
  // then fix at the end (since we don't know the width yet)
69268
- var xLeft = Math.round(opts.x * gs.w + opts.xpad);
69281
+ var uPx = Math.round(optsX * gs.w + xpad);
69269
69282
  // for dragging... this is getting a little muddled...
69270
- var xLeftFrac = opts.x - thickFrac * ({center: 0.5, right: 1}[opts.xanchor] || 0);
69283
+ var uFrac = optsX - thickFrac * ({center: 0.5, right: 1}[xanchor] || 0);
69271
69284
 
69272
69285
  // y positioning we can do correctly from the start
69273
- var yBottomFrac = opts.y + lenFrac * (({top: -0.5, bottom: 0.5}[opts.yanchor] || 0) - 0.5);
69274
- var yBottomPx = Math.round(gs.h * (1 - yBottomFrac));
69275
- var yTopPx = yBottomPx - lenPx;
69286
+ var vFrac = optsY + lenFrac * (({top: -0.5, bottom: 0.5}[yanchor] || 0) - 0.5);
69287
+ var vPx = Math.round(gs.h * (1 - vFrac));
69276
69288
 
69277
69289
  // stash a few things for makeEditable
69278
69290
  opts._lenFrac = lenFrac;
69279
69291
  opts._thickFrac = thickFrac;
69280
- opts._xLeftFrac = xLeftFrac;
69281
- opts._yBottomFrac = yBottomFrac;
69292
+ opts._uFrac = uFrac;
69293
+ opts._vFrac = vFrac;
69282
69294
 
69283
69295
  // stash mocked axis for contour label formatting
69284
69296
  var ax = opts._axis = mockColorBarAxis(gd, opts, zrange);
69285
69297
 
69286
69298
  // position can't go in through supplyDefaults
69287
69299
  // because that restricts it to [0,1]
69288
- ax.position = opts.x + xpadFrac + thickFrac;
69300
+ ax.position = optsX + xpadFrac + thickFrac;
69289
69301
 
69290
69302
  if(['top', 'bottom'].indexOf(titleSide) !== -1) {
69291
69303
  ax.title.side = titleSide;
69292
- ax.titlex = opts.x + xpadFrac;
69293
- ax.titley = yBottomFrac + (title.side === 'top' ? lenFrac - ypadFrac : ypadFrac);
69304
+ ax.titlex = optsX + xpadFrac;
69305
+ ax.titley = vFrac + (title.side === 'top' ? lenFrac - ypadFrac : ypadFrac);
69294
69306
  }
69295
69307
 
69296
69308
  if(line.color && opts.tickmode === 'auto') {
@@ -69298,7 +69310,7 @@ function drawColorBar(g, opts, gd) {
69298
69310
  ax.tick0 = levelsIn.start;
69299
69311
  var dtick = levelsIn.size;
69300
69312
  // expand if too many contours, so we don't get too many ticks
69301
- var autoNtick = Lib.constrain((yBottomPx - yTopPx) / 50, 4, 15) + 1;
69313
+ var autoNtick = Lib.constrain(lenPx / 50, 4, 15) + 1;
69302
69314
  var dtFactor = (zrange[1] - zrange[0]) / ((opts.nticks || autoNtick) * dtick);
69303
69315
  if(dtFactor > 1) {
69304
69316
  var dtexp = Math.pow(10, Math.floor(Math.log(dtFactor) / Math.LN10));
@@ -69316,8 +69328,8 @@ function drawColorBar(g, opts, gd) {
69316
69328
  // set domain after init, because we may want to
69317
69329
  // allow it outside [0,1]
69318
69330
  ax.domain = [
69319
- yBottomFrac + ypadFrac,
69320
- yBottomFrac + lenFrac - ypadFrac
69331
+ vFrac + ypadFrac,
69332
+ vFrac + lenFrac - ypadFrac
69321
69333
  ];
69322
69334
 
69323
69335
  ax.setScale();
@@ -69358,15 +69370,15 @@ function drawColorBar(g, opts, gd) {
69358
69370
  // draw the title so we know how much room it needs
69359
69371
  // when we squish the axis. This one only applies to
69360
69372
  // top or bottom titles, not right side.
69361
- var x = gs.l + (opts.x + xpadFrac) * gs.w;
69373
+ var x = gs.l + (optsX + xpadFrac) * gs.w;
69362
69374
  var fontSize = ax.title.font.size;
69363
69375
  var y;
69364
69376
 
69365
69377
  if(titleSide === 'top') {
69366
- y = (1 - (yBottomFrac + lenFrac - ypadFrac)) * gs.h +
69378
+ y = (1 - (vFrac + lenFrac - ypadFrac)) * gs.h +
69367
69379
  gs.t + 3 + fontSize * 0.75;
69368
69380
  } else {
69369
- y = (1 - (yBottomFrac + ypadFrac)) * gs.h +
69381
+ y = (1 - (vFrac + ypadFrac)) * gs.h +
69370
69382
  gs.t - 3 - fontSize * 0.25;
69371
69383
  }
69372
69384
  drawTitle(ax._id + 'title', {
@@ -69405,7 +69417,7 @@ function drawColorBar(g, opts, gd) {
69405
69417
  // squish the axis top to make room for the title
69406
69418
  var titleGroup = g.select('.' + cn.cbtitle);
69407
69419
  var titleText = titleGroup.select('text');
69408
- var titleTrans = [-opts.outlinewidth / 2, opts.outlinewidth / 2];
69420
+ var titleTrans = [-outlinewidth / 2, outlinewidth / 2];
69409
69421
  var mathJaxNode = titleGroup
69410
69422
  .select('.h' + ax._id + 'title-math-group')
69411
69423
  .node();
@@ -69477,7 +69489,7 @@ function drawColorBar(g, opts, gd) {
69477
69489
  // Colorbar cannot currently support opacities so we
69478
69490
  // use an opaque fill even when alpha channels present
69479
69491
  var fillEl = d3.select(this).attr({
69480
- x: xLeft,
69492
+ x: uPx,
69481
69493
  width: Math.max(thickPx, 2),
69482
69494
  y: d3.min(z),
69483
69495
  height: Math.max(d3.max(z) - d3.min(z), 2),
@@ -69501,7 +69513,7 @@ function drawColorBar(g, opts, gd) {
69501
69513
  lines.exit().remove();
69502
69514
  lines.each(function(d) {
69503
69515
  d3.select(this)
69504
- .attr('d', 'M' + xLeft + ',' +
69516
+ .attr('d', 'M' + uPx + ',' +
69505
69517
  (Math.round(ax.c2p(d)) + (line.width / 2) % 1) + 'h' + thickPx)
69506
69518
  .call(Drawing.lineGroupStyle, line.width, lineColormap(d), line.dash);
69507
69519
  });
@@ -69509,8 +69521,8 @@ function drawColorBar(g, opts, gd) {
69509
69521
  // force full redraw of labels and ticks
69510
69522
  axLayer.selectAll('g.' + ax._id + 'tick,path').remove();
69511
69523
 
69512
- var shift = xLeft + thickPx +
69513
- (opts.outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0);
69524
+ var shift = uPx + thickPx +
69525
+ (outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0);
69514
69526
 
69515
69527
  var vals = Axes.calcTicks(ax);
69516
69528
  var tickSign = Axes.getTickSigns(ax)[2];
@@ -69535,9 +69547,9 @@ function drawColorBar(g, opts, gd) {
69535
69547
  // TODO: why are we redrawing multiple times now with this?
69536
69548
  // I guess autoMargin doesn't like being post-promise?
69537
69549
  function positionCB() {
69538
- var innerWidth = thickPx + opts.outlinewidth / 2;
69550
+ var innerThickness = thickPx + outlinewidth / 2;
69539
69551
  if(ax.ticklabelposition.indexOf('inside') === -1) {
69540
- innerWidth += Drawing.bBox(axLayer.node()).width;
69552
+ innerThickness += Drawing.bBox(axLayer.node()).width;
69541
69553
  }
69542
69554
 
69543
69555
  titleEl = titleCont.select('text');
@@ -69552,66 +69564,65 @@ function drawColorBar(g, opts, gd) {
69552
69564
  // (except for top/bottom mathjax, above)
69553
69565
  // but the weird gs.l is because the titleunshift
69554
69566
  // transform gets removed by Drawing.bBox
69555
- titleWidth = Drawing.bBox(titleCont.node()).right - xLeft - gs.l;
69567
+ titleWidth = Drawing.bBox(titleCont.node()).right - uPx - gs.l;
69556
69568
  }
69557
- innerWidth = Math.max(innerWidth, titleWidth);
69569
+ innerThickness = Math.max(innerThickness, titleWidth);
69558
69570
  }
69559
69571
 
69560
- var outerwidth = 2 * opts.xpad + innerWidth + opts.borderwidth + opts.outlinewidth / 2;
69561
- var outerheight = yBottomPx - yTopPx;
69572
+ var outerThickness = 2 * xpad + innerThickness + borderwidth + outlinewidth / 2;
69562
69573
 
69563
69574
  g.select('.' + cn.cbbg).attr({
69564
- x: xLeft - opts.xpad - (opts.borderwidth + opts.outlinewidth) / 2,
69565
- y: yTopPx - yExtraPx,
69566
- width: Math.max(outerwidth, 2),
69567
- height: Math.max(outerheight + 2 * yExtraPx, 2)
69575
+ x: uPx - xpad - (borderwidth + outlinewidth) / 2,
69576
+ y: vPx - lenPx - yExtraPx,
69577
+ width: Math.max(outerThickness, 2),
69578
+ height: Math.max(lenPx + 2 * yExtraPx, 2)
69568
69579
  })
69569
69580
  .call(Color.fill, opts.bgcolor)
69570
69581
  .call(Color.stroke, opts.bordercolor)
69571
- .style('stroke-width', opts.borderwidth);
69582
+ .style('stroke-width', borderwidth);
69572
69583
 
69573
69584
  g.selectAll('.' + cn.cboutline).attr({
69574
- x: xLeft,
69575
- y: yTopPx + opts.ypad + (titleSide === 'top' ? titleHeight : 0),
69585
+ x: uPx,
69586
+ y: vPx - lenPx + ypad + (titleSide === 'top' ? titleHeight : 0),
69576
69587
  width: Math.max(thickPx, 2),
69577
- height: Math.max(outerheight - 2 * opts.ypad - titleHeight, 2)
69588
+ height: Math.max(lenPx - 2 * ypad - titleHeight, 2)
69578
69589
  })
69579
69590
  .call(Color.stroke, opts.outlinecolor)
69580
69591
  .style({
69581
69592
  fill: 'none',
69582
- 'stroke-width': opts.outlinewidth
69593
+ 'stroke-width': outlinewidth
69583
69594
  });
69584
69595
 
69585
69596
  // fix positioning for xanchor!='left'
69586
- var xoffset = ({center: 0.5, right: 1}[opts.xanchor] || 0) * outerwidth;
69597
+ var xoffset = ({center: 0.5, right: 1}[xanchor] || 0) * outerThickness;
69587
69598
  g.attr('transform', strTranslate(gs.l - xoffset, gs.t));
69588
69599
 
69589
69600
  // auto margin adjustment
69590
69601
  var marginOpts = {};
69591
- var tFrac = FROM_TL[opts.yanchor];
69592
- var bFrac = FROM_BR[opts.yanchor];
69593
- if(opts.lenmode === 'pixels') {
69594
- marginOpts.y = opts.y;
69595
- marginOpts.t = outerheight * tFrac;
69596
- marginOpts.b = outerheight * bFrac;
69602
+ var tFrac = FROM_TL[yanchor];
69603
+ var bFrac = FROM_BR[yanchor];
69604
+ if(lenmode === 'pixels') {
69605
+ marginOpts.y = optsY;
69606
+ marginOpts.t = lenPx * tFrac;
69607
+ marginOpts.b = lenPx * bFrac;
69597
69608
  } else {
69598
69609
  marginOpts.t = marginOpts.b = 0;
69599
- marginOpts.yt = opts.y + opts.len * tFrac;
69600
- marginOpts.yb = opts.y - opts.len * bFrac;
69610
+ marginOpts.yt = optsY + len * tFrac;
69611
+ marginOpts.yb = optsY - len * bFrac;
69601
69612
  }
69602
69613
 
69603
- var lFrac = FROM_TL[opts.xanchor];
69604
- var rFrac = FROM_BR[opts.xanchor];
69605
- if(opts.thicknessmode === 'pixels') {
69606
- marginOpts.x = opts.x;
69607
- marginOpts.l = outerwidth * lFrac;
69608
- marginOpts.r = outerwidth * rFrac;
69614
+ var lFrac = FROM_TL[xanchor];
69615
+ var rFrac = FROM_BR[xanchor];
69616
+ if(thicknessmode === 'pixels') {
69617
+ marginOpts.x = optsX;
69618
+ marginOpts.l = outerThickness * lFrac;
69619
+ marginOpts.r = outerThickness * rFrac;
69609
69620
  } else {
69610
- var extraThickness = outerwidth - thickPx;
69621
+ var extraThickness = outerThickness - thickPx;
69611
69622
  marginOpts.l = extraThickness * lFrac;
69612
69623
  marginOpts.r = extraThickness * rFrac;
69613
- marginOpts.xl = opts.x - opts.thickness * lFrac;
69614
- marginOpts.xr = opts.x + opts.thickness * rFrac;
69624
+ marginOpts.xl = optsX - thickness * lFrac;
69625
+ marginOpts.xr = optsX + thickness * rFrac;
69615
69626
  }
69616
69627
 
69617
69628
  Plots.autoMargin(gd, opts._id, marginOpts);
@@ -69642,9 +69653,9 @@ function makeEditable(g, opts, gd) {
69642
69653
  moveFn: function(dx, dy) {
69643
69654
  g.attr('transform', t0 + strTranslate(dx, dy));
69644
69655
 
69645
- xf = dragElement.align(opts._xLeftFrac + (dx / gs.w), opts._thickFrac,
69656
+ xf = dragElement.align(opts._uFrac + (dx / gs.w), opts._thickFrac,
69646
69657
  0, 1, opts.xanchor);
69647
- yf = dragElement.align(opts._yBottomFrac - (dy / gs.h), opts._lenFrac,
69658
+ yf = dragElement.align(opts._vFrac - (dy / gs.h), opts._lenFrac,
69648
69659
  0, 1, opts.yanchor);
69649
69660
 
69650
69661
  var csr = dragElement.getCursor(xf, yf, opts.xanchor, opts.yanchor);
@@ -72223,7 +72234,7 @@ var TEXTOFFSETSIGN = {
72223
72234
  start: 1, end: -1, middle: 0, bottom: 1, top: -1
72224
72235
  };
72225
72236
 
72226
- function textPointPosition(s, textPosition, fontSize, markerRadius) {
72237
+ function textPointPosition(s, textPosition, fontSize, markerRadius, dontTouchParent) {
72227
72238
  var group = d3.select(s.node().parentNode);
72228
72239
 
72229
72240
  var v = textPosition.indexOf('top') !== -1 ?
@@ -72245,7 +72256,9 @@ function textPointPosition(s, textPosition, fontSize, markerRadius) {
72245
72256
 
72246
72257
  // fix the overall text group position
72247
72258
  s.attr('text-anchor', h);
72248
- group.attr('transform', strTranslate(dx, dy));
72259
+ if(!dontTouchParent) {
72260
+ group.attr('transform', strTranslate(dx, dy));
72261
+ }
72249
72262
  }
72250
72263
 
72251
72264
  function extracTextFontSize(d, trace) {
@@ -72315,7 +72328,8 @@ drawing.selectedTextStyle = function(s, trace) {
72315
72328
  var fontSize = extracTextFontSize(d, trace);
72316
72329
 
72317
72330
  Color.fill(tx, tc);
72318
- textPointPosition(tx, tp, fontSize, d.mrc2 || d.mrc);
72331
+ var dontTouchParent = Registry.traceIs(trace, 'bar-like');
72332
+ textPointPosition(tx, tp, fontSize, d.mrc2 || d.mrc, dontTouchParent);
72319
72333
  });
72320
72334
  };
72321
72335
 
@@ -74346,11 +74360,13 @@ var cartesianScatterPoints = {
74346
74360
  // The actual rendering is done by private function _hover.
74347
74361
  exports.hover = function hover(gd, evt, subplot, noHoverEvent) {
74348
74362
  gd = Lib.getGraphDiv(gd);
74349
-
74363
+ // The 'target' property changes when bubbling out of Shadow DOM.
74364
+ // Throttling can delay reading the target, so we save the current value.
74365
+ var eventTarget = evt.target;
74350
74366
  Lib.throttle(
74351
74367
  gd._fullLayout._uid + constants.HOVERID,
74352
74368
  constants.HOVERMINTIME,
74353
- function() { _hover(gd, evt, subplot, noHoverEvent); }
74369
+ function() { _hover(gd, evt, subplot, noHoverEvent, eventTarget); }
74354
74370
  );
74355
74371
  };
74356
74372
 
@@ -74515,7 +74531,7 @@ exports.loneHover = function loneHover(hoverItems, opts) {
74515
74531
  };
74516
74532
 
74517
74533
  // The actual implementation is here:
74518
- function _hover(gd, evt, subplot, noHoverEvent) {
74534
+ function _hover(gd, evt, subplot, noHoverEvent, eventTarget) {
74519
74535
  if(!subplot) subplot = 'xy';
74520
74536
 
74521
74537
  // if the user passed in an array of subplots,
@@ -74634,7 +74650,7 @@ function _hover(gd, evt, subplot, noHoverEvent) {
74634
74650
  // [x|y]px: the pixels (from top left) of the mouse location
74635
74651
  // on the currently selected plot area
74636
74652
  // add pointerX|Y property for drawing the spikes in spikesnap 'cursor' situation
74637
- var hasUserCalledHover = !evt.target;
74653
+ var hasUserCalledHover = !eventTarget;
74638
74654
  var xpx, ypx;
74639
74655
 
74640
74656
  if(hasUserCalledHover) {
@@ -74651,13 +74667,7 @@ function _hover(gd, evt, subplot, noHoverEvent) {
74651
74667
  return;
74652
74668
  }
74653
74669
 
74654
- // Discover event target, traversing open shadow roots.
74655
- var target = evt.composedPath && evt.composedPath()[0];
74656
- if(!target) {
74657
- // Fallback for browsers not supporting composedPath
74658
- target = evt.target;
74659
- }
74660
- var dbb = target.getBoundingClientRect();
74670
+ var dbb = eventTarget.getBoundingClientRect();
74661
74671
 
74662
74672
  xpx = evt.clientX - dbb.left;
74663
74673
  ypx = evt.clientY - dbb.top;
@@ -75105,15 +75115,15 @@ function _hover(gd, evt, subplot, noHoverEvent) {
75105
75115
  if(!helpers.isUnifiedHover(hovermode)) {
75106
75116
  hoverAvoidOverlaps(hoverLabels, rotateLabels ? 'xa' : 'ya', fullLayout);
75107
75117
  alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY);
75108
- } // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true
75118
+ } // TODO: tagName hack is needed to appease geo.js's hack of using eventTarget=true
75109
75119
  // we should improve the "fx" API so other plots can use it without these hack.
75110
- if(evt.target && evt.target.tagName) {
75120
+ if(eventTarget && eventTarget.tagName) {
75111
75121
  var hasClickToShow = Registry.getComponentMethod('annotations', 'hasClickToShow')(gd, newhoverdata);
75112
- overrideCursor(d3.select(evt.target), hasClickToShow ? 'pointer' : '');
75122
+ overrideCursor(d3.select(eventTarget), hasClickToShow ? 'pointer' : '');
75113
75123
  }
75114
75124
 
75115
75125
  // don't emit events if called manually
75116
- if(!evt.target || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return;
75126
+ if(!eventTarget || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return;
75117
75127
 
75118
75128
  if(oldhoverdata) {
75119
75129
  gd.emit('plotly_unhover', {
@@ -98895,7 +98905,8 @@ function findUIPattern(key, patternSpecs) {
98895
98905
  var spec = patternSpecs[i];
98896
98906
  var match = key.match(spec.pattern);
98897
98907
  if(match) {
98898
- 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};
98899
98910
  }
98900
98911
  }
98901
98912
  }
@@ -98947,26 +98958,54 @@ function valsMatch(v1, v2) {
98947
98958
 
98948
98959
  function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
98949
98960
  var layoutPreGUI = oldFullLayout._preGUI;
98950
- var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal;
98961
+ var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal, head, tail;
98951
98962
  var bothInheritAutorange = [];
98963
+ var newAutorangeIn = {};
98952
98964
  var newRangeAccepted = {};
98953
98965
  for(key in layoutPreGUI) {
98954
98966
  match = findUIPattern(key, layoutUIControlPatterns);
98955
98967
  if(match) {
98956
- revAttr = match.attr || (match.head + '.uirevision');
98968
+ head = match.head;
98969
+ tail = match.tail;
98970
+ revAttr = match.attr || (head + '.uirevision');
98957
98971
  oldRev = nestedProperty(oldFullLayout, revAttr).get();
98958
98972
  newRev = oldRev && getNewRev(revAttr, layout);
98973
+
98959
98974
  if(newRev && (newRev === oldRev)) {
98960
98975
  preGUIVal = layoutPreGUI[key];
98961
98976
  if(preGUIVal === null) preGUIVal = undefined;
98962
98977
  newNP = nestedProperty(layout, key);
98963
98978
  newVal = newNP.get();
98979
+
98964
98980
  if(valsMatch(newVal, preGUIVal)) {
98965
- if(newVal === undefined && key.substr(key.length - 9) === 'autorange') {
98966
- bothInheritAutorange.push(key.substr(0, key.length - 10));
98981
+ if(newVal === undefined && tail === 'autorange') {
98982
+ bothInheritAutorange.push(head);
98967
98983
  }
98968
98984
  newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));
98969
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
+ }
98970
99009
  }
98971
99010
  }
98972
99011
  } else {
@@ -98977,12 +99016,12 @@ function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
98977
99016
  // so remove it from _preGUI for next time.
98978
99017
  delete layoutPreGUI[key];
98979
99018
 
98980
- if(key.substr(key.length - 8, 6) === 'range[') {
98981
- newRangeAccepted[key.substr(0, key.length - 9)] = 1;
99019
+ if(match && match.tail.substr(0, 6) === 'range[') {
99020
+ newRangeAccepted[match.head] = 1;
98982
99021
  }
98983
99022
  }
98984
99023
 
98985
- // Special logic for `autorange`, since it interacts with `range`:
99024
+ // More special logic for `autorange`, since it interacts with `range`:
98986
99025
  // If the new figure's matching `range` was kept, and `autorange`
98987
99026
  // wasn't supplied explicitly in either the original or the new figure,
98988
99027
  // we shouldn't alter that - but we may just have done that, so fix it.
@@ -118354,11 +118393,14 @@ proto.project = function(v) {
118354
118393
  proto.getView = function() {
118355
118394
  var map = this.map;
118356
118395
  var mapCenter = map.getCenter();
118357
- 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 };
118358
118399
 
118359
118400
  var canvas = map.getCanvas();
118360
- var w = canvas.width;
118361
- var h = canvas.height;
118401
+ var w = parseInt(canvas.style.width);
118402
+ var h = parseInt(canvas.style.height);
118403
+
118362
118404
  return {
118363
118405
  center: center,
118364
118406
  zoom: map.getZoom(),
@@ -129495,7 +129537,7 @@ function getSortFunc(opts, d2c) {
129495
129537
  'use strict';
129496
129538
 
129497
129539
  // package version injected by `npm run preprocess`
129498
- exports.version = '2.6.1';
129540
+ exports.version = '2.7.0';
129499
129541
 
129500
129542
  },{}]},{},[9])(9)
129501
129543
  });