Skip to content

Commit 057c811

Browse files
committed
Merge branch 'master' into transitions-in-react
2 parents 8ab38be + cc45972 commit 057c811

File tree

95 files changed

+1874
-600
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1874
-600
lines changed

package-lock.json

Lines changed: 150 additions & 225 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,23 @@
7171
"es6-promise": "^3.0.2",
7272
"fast-isnumeric": "^1.1.2",
7373
"font-atlas-sdf": "^1.3.3",
74-
"gl-cone3d": "^1.2.1",
75-
"gl-contour2d": "^1.1.4",
76-
"gl-error3d": "^1.0.9",
77-
"gl-heatmap2d": "^1.0.4",
78-
"gl-line3d": "^1.1.6",
74+
"gl-cone3d": "^1.2.2",
75+
"gl-contour2d": "^1.1.5",
76+
"gl-error3d": "^1.0.11",
77+
"gl-heatmap2d": "^1.0.5",
78+
"gl-line3d": "^1.1.8",
7979
"gl-mat4": "^1.2.0",
80-
"gl-mesh3d": "^2.0.2",
81-
"gl-plot2d": "^1.4.0",
82-
"gl-plot3d": "^1.6.1",
83-
"gl-pointcloud2d": "^1.0.1",
84-
"gl-scatter3d": "^1.1.2",
85-
"gl-select-box": "^1.0.2",
86-
"gl-spikes2d": "^1.0.1",
87-
"gl-streamtube3d": "^1.1.1",
88-
"gl-surface3d": "^1.4.0",
80+
"gl-mesh3d": "^2.0.5",
81+
"gl-plot2d": "^1.4.1",
82+
"gl-plot3d": "^1.6.2",
83+
"gl-pointcloud2d": "^1.0.2",
84+
"gl-scatter3d": "^1.1.3",
85+
"gl-select-box": "^1.0.3",
86+
"gl-spikes2d": "^1.0.2",
87+
"gl-streamtube3d": "^1.1.2",
88+
"gl-surface3d": "^1.4.1",
8989
"gl-text": "^1.1.6",
90-
"glslify": "^6.3.1",
90+
"glslify": "^7.0.0",
9191
"has-hover": "^1.0.1",
9292
"has-passive-events": "^1.0.0",
9393
"mapbox-gl": "0.45.0",
@@ -101,10 +101,10 @@
101101
"point-cluster": "^3.1.4",
102102
"polybooljs": "^1.2.0",
103103
"regl": "^1.3.11",
104-
"regl-error2d": "^2.0.5",
105-
"regl-line2d": "^3.0.12",
106-
"regl-scatter2d": "^3.1.2",
107-
"regl-splom": "^1.0.5",
104+
"regl-error2d": "^2.0.6",
105+
"regl-line2d": "3.0.13",
106+
"regl-scatter2d": "^3.1.3",
107+
"regl-splom": "^1.0.6",
108108
"right-now": "^1.0.0",
109109
"robust-orientation": "^1.1.3",
110110
"sane-topojson": "^2.0.0",
@@ -121,7 +121,7 @@
121121
"browserify": "^16.2.3",
122122
"browserify-transform-tools": "^1.7.0",
123123
"check-node-version": "^3.2.0",
124-
"chttps": "^1.0.5",
124+
"chttps": "^1.0.6",
125125
"deep-equal": "^1.0.1",
126126
"derequire": "^2.0.6",
127127
"ecstatic": "^3.3.0",

src/components/annotations/draw.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,13 @@ function drawRaw(gd, options, index, subplotId, xa, ya) {
209209

210210
var font = options.font;
211211

212+
var text = fullLayout.meta ?
213+
Lib.templateString(options.text, {meta: fullLayout.meta}) :
214+
options.text;
215+
212216
var annText = annTextGroupInner.append('text')
213217
.classed('annotation-text', true)
214-
.text(options.text);
218+
.text(text);
215219

216220
function textLayout(s) {
217221
s.call(Drawing.font, font)
@@ -678,6 +682,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) {
678682
.call(textLayout)
679683
.on('edit', function(_text) {
680684
options.text = _text;
685+
681686
this.call(textLayout);
682687

683688
modifyItem('text', _text);

src/components/colorbar/connect.js

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,26 @@ module.exports = function connectColorbar(gd, cd, moduleOpts) {
4141

4242
var trace = cd[0].trace;
4343
var cbId = 'cb' + trace.uid;
44-
var containerName = moduleOpts.container;
45-
var container = containerName ? trace[containerName] : trace;
44+
moduleOpts = Array.isArray(moduleOpts) ? moduleOpts : [moduleOpts];
4645

47-
gd._fullLayout._infolayer.selectAll('.' + cbId).remove();
48-
if(!container || !container.showscale) return;
46+
for(var i = 0; i < moduleOpts.length; i++) {
47+
var containerName = moduleOpts[i].container;
4948

50-
var cb = cd[0].t.cb = drawColorbar(gd, cbId);
49+
var container = containerName ? trace[containerName] : trace;
5150

52-
var scl = container.reversescale ?
53-
flipScale(container.colorscale) :
54-
container.colorscale;
51+
gd._fullLayout._infolayer.selectAll('.' + cbId).remove();
52+
if(!container || !container.showscale) continue;
5553

56-
cb.fillgradient(scl)
57-
.zrange([container[moduleOpts.min], container[moduleOpts.max]])
58-
.options(container.colorbar)();
54+
var cb = cd[0].t.cb = drawColorbar(gd, cbId);
55+
56+
var scl = container.reversescale ?
57+
flipScale(container.colorscale) :
58+
container.colorscale;
59+
60+
cb.fillgradient(scl)
61+
.zrange([container[moduleOpts[i].min], container[moduleOpts[i].max]])
62+
.options(container.colorbar)();
63+
64+
return;
65+
}
5966
};

src/components/legend/draw.js

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,20 @@ module.exports = function draw(gd) {
108108
traces.enter().append('g').attr('class', 'traces');
109109
traces.exit().remove();
110110

111-
traces.call(style, gd)
112-
.style('opacity', function(d) {
113-
var trace = d[0].trace;
114-
if(Registry.traceIs(trace, 'pie')) {
115-
return hiddenSlices.indexOf(d[0].label) !== -1 ? 0.5 : 1;
116-
} else {
117-
return trace.visible === 'legendonly' ? 0.5 : 1;
118-
}
119-
})
120-
.each(function() {
121-
d3.select(this)
122-
.call(drawTexts, gd, maxLength)
123-
.call(setupTraceToggle, gd);
124-
});
111+
traces.style('opacity', function(d) {
112+
var trace = d[0].trace;
113+
if(Registry.traceIs(trace, 'pie')) {
114+
return hiddenSlices.indexOf(d[0].label) !== -1 ? 0.5 : 1;
115+
} else {
116+
return trace.visible === 'legendonly' ? 0.5 : 1;
117+
}
118+
})
119+
.each(function() {
120+
d3.select(this)
121+
.call(drawTexts, gd, maxLength)
122+
.call(setupTraceToggle, gd);
123+
})
124+
.call(style, gd);
125125

126126
Lib.syncOrAsync([Plots.previousPromises,
127127
function() {
@@ -522,8 +522,7 @@ function computeTextDimensions(g, gd) {
522522
width = mathjaxBB.width;
523523

524524
Drawing.setTranslate(mathjaxGroup, 0, (height / 4));
525-
}
526-
else {
525+
} else {
527526
var text = g.select('.legendtext');
528527
var textLines = svgTextUtils.lineCount(text);
529528
var textNode = text.node();
@@ -535,12 +534,10 @@ function computeTextDimensions(g, gd) {
535534
// to avoid getBoundingClientRect
536535
var textY = lineHeight * (0.3 + (1 - textLines) / 2);
537536
svgTextUtils.positionText(text, constants.textOffsetX, textY);
538-
legendItem.lineHeight = lineHeight;
539537
}
540538

541-
height = Math.max(height, 16) + 3;
542-
543-
legendItem.height = height;
539+
legendItem.lineHeight = lineHeight;
540+
legendItem.height = Math.max(height, 16) + 3;
544541
legendItem.width = width;
545542
}
546543

src/components/legend/style.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = function style(s, gd) {
3131
var height = d[0].height;
3232

3333
if(valign === 'middle' || !lineHeight || !height) {
34-
layers.attr('transform', null); // this here is a fun d3 trick to unset DOM attributes
34+
layers.attr('transform', null);
3535
} else {
3636
var factor = {top: 1, bottom: -1}[valign];
3737
var markerOffsetY = factor * (0.5 * (lineHeight - height + 3));

src/components/titles/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ function draw(gd, titleClass, options) {
9797
if(!editable) txt = '';
9898
}
9999

100+
if(fullLayout.meta) {
101+
txt = Lib.templateString(txt, {meta: fullLayout.meta});
102+
}
103+
100104
var elShouldExist = txt || editable;
101105

102106
if(!group) {

src/lib/loggers.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
/* eslint-disable no-console */
1212

13-
var config = require('../plot_api/plot_config');
13+
var dfltConfig = require('../plot_api/plot_config').dfltConfig;
1414

1515
var loggers = module.exports = {};
1616

@@ -21,7 +21,7 @@ var loggers = module.exports = {};
2121
*/
2222

2323
loggers.log = function() {
24-
if(config.logging > 1) {
24+
if(dfltConfig.logging > 1) {
2525
var messages = ['LOG:'];
2626

2727
for(var i = 0; i < arguments.length; i++) {
@@ -33,7 +33,7 @@ loggers.log = function() {
3333
};
3434

3535
loggers.warn = function() {
36-
if(config.logging > 0) {
36+
if(dfltConfig.logging > 0) {
3737
var messages = ['WARN:'];
3838

3939
for(var i = 0; i < arguments.length; i++) {
@@ -45,7 +45,7 @@ loggers.warn = function() {
4545
};
4646

4747
loggers.error = function() {
48-
if(config.logging > 0) {
48+
if(dfltConfig.logging > 0) {
4949
var messages = ['ERROR:'];
5050

5151
for(var i = 0; i < arguments.length; i++) {

src/lib/queue.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
109
'use strict';
1110

1211
var Lib = require('../lib');
13-
var config = require('../plot_api/plot_config');
14-
12+
var dfltConfig = require('../plot_api/plot_config').dfltConfig;
1513

1614
/**
1715
* Copy arg array *without* removing `undefined` values from objects.
@@ -91,7 +89,7 @@ queue.add = function(gd, undoFunc, undoArgs, redoFunc, redoArgs) {
9189
queueObj.redo.args.push(redoArgs);
9290
}
9391

94-
if(gd.undoQueue.queue.length > config.queueLength) {
92+
if(gd.undoQueue.queue.length > dfltConfig.queueLength) {
9593
gd.undoQueue.queue.shift();
9694
gd.undoQueue.index--;
9795
}

src/plot_api/plot_api.js

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var initInteractions = require('../plots/cartesian/graph_interact').initInteract
3333
var xmlnsNamespaces = require('../constants/xmlns_namespaces');
3434
var svgTextUtils = require('../lib/svg_text_utils');
3535

36-
var defaultConfig = require('./plot_config');
36+
var dfltConfig = require('./plot_config').dfltConfig;
3737
var manageArrays = require('./manage_arrays');
3838
var helpers = require('./helpers');
3939
var subroutines = require('./subroutines');
@@ -405,7 +405,7 @@ function emitAfterPlot(gd) {
405405
}
406406

407407
exports.setPlotConfig = function setPlotConfig(obj) {
408-
return Lib.extendFlat(defaultConfig, obj);
408+
return Lib.extendFlat(dfltConfig, obj);
409409
};
410410

411411
function setBackground(gd, bgColor) {
@@ -423,7 +423,7 @@ function opaqueSetBackground(gd, bgColor) {
423423

424424
function setPlotContext(gd, config) {
425425
if(!gd._context) {
426-
gd._context = Lib.extendDeep({}, defaultConfig);
426+
gd._context = Lib.extendDeep({}, dfltConfig);
427427

428428
// stash <base> href, used to make robust clipPath URLs
429429
var base = d3.select('base');
@@ -507,6 +507,25 @@ function setPlotContext(gd, config) {
507507
// Check if gd has a specified widht/height to begin with
508508
context._hasZeroHeight = context._hasZeroHeight || gd.clientHeight === 0;
509509
context._hasZeroWidth = context._hasZeroWidth || gd.clientWidth === 0;
510+
511+
// fill context._scrollZoom helper to help manage scrollZoom flaglist
512+
var szIn = context.scrollZoom;
513+
var szOut = context._scrollZoom = {};
514+
if(szIn === true) {
515+
szOut.cartesian = 1;
516+
szOut.gl3d = 1;
517+
szOut.geo = 1;
518+
szOut.mapbox = 1;
519+
} else if(typeof szIn === 'string') {
520+
var parts = szIn.split('+');
521+
for(i = 0; i < parts.length; i++) {
522+
szOut[parts[i]] = 1;
523+
}
524+
} else if(szIn !== false) {
525+
szOut.gl3d = 1;
526+
szOut.geo = 1;
527+
szOut.mapbox = 1;
528+
}
510529
}
511530

512531
function plotLegacyPolar(gd, data, layout) {

0 commit comments

Comments
 (0)