Skip to content

Commit 08d3fe0

Browse files
committed
Merge branch 'master' into namelength-zero-fix
2 parents 918d22e + 5baa139 commit 08d3fe0

Some content is hidden

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

71 files changed

+9796
-314
lines changed

lib/index-gl3d.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Plotly.register([
1414
require('./scatter3d'),
1515
require('./surface'),
1616
require('./mesh3d'),
17+
require('./isosurface'),
18+
require('./volume'),
1719
require('./cone'),
1820
require('./streamtube')
1921
]);

lib/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Plotly.register([
2929
require('./scatter3d'),
3030
require('./surface'),
3131
require('./isosurface'),
32+
require('./volume'),
3233
require('./mesh3d'),
3334
require('./cone'),
3435
require('./streamtube'),

lib/volume.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* Copyright 2012-2019, Plotly, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
'use strict';
10+
11+
module.exports = require('../src/traces/volume');

package-lock.json

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

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"gl-heatmap2d": "^1.0.5",
7979
"gl-line3d": "^1.1.11",
8080
"gl-mat4": "^1.2.0",
81-
"gl-mesh3d": "^2.0.10",
81+
"gl-mesh3d": "^2.1.0",
8282
"gl-plot2d": "^1.4.2",
8383
"gl-plot3d": "^2.2.1",
8484
"gl-pointcloud2d": "^1.0.2",
@@ -102,7 +102,7 @@
102102
"point-cluster": "^3.1.4",
103103
"polybooljs": "^1.2.0",
104104
"regl": "^1.3.11",
105-
"regl-error2d": "^2.0.6",
105+
"regl-error2d": "^2.0.7",
106106
"regl-line2d": "3.0.13",
107107
"regl-scatter2d": "^3.1.4",
108108
"regl-splom": "^1.0.6",

src/components/dragelement/index.js

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,13 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
109
'use strict';
1110

1211
var mouseOffset = require('mouse-event-offset');
1312
var hasHover = require('has-hover');
1413
var supportsPassive = require('has-passive-events');
1514

16-
var Registry = require('../../registry');
17-
var Lib = require('../../lib');
18-
15+
var removeElement = require('../../lib').removeElement;
1916
var constants = require('../../plots/cartesian/constants');
2017
var interactConstants = require('../../constants/interactions');
2118

@@ -28,7 +25,6 @@ var unhover = require('./unhover');
2825
dragElement.unhover = unhover.wrapped;
2926
dragElement.unhoverRaw = unhover.raw;
3027

31-
3228
/**
3329
* Abstracts click & drag interactions
3430
*
@@ -106,8 +102,7 @@ dragElement.init = function init(options) {
106102

107103
if(!supportsPassive) {
108104
element.ontouchstart = onStart;
109-
}
110-
else {
105+
} else {
111106
if(element._ontouchstart) {
112107
element.removeEventListener('touchstart', element._ontouchstart);
113108
}
@@ -145,8 +140,7 @@ dragElement.init = function init(options) {
145140
if(newMouseDownTime - gd._mouseDownTime < DBLCLICKDELAY) {
146141
// in a click train
147142
numClicks += 1;
148-
}
149-
else {
143+
} else {
150144
// new click train
151145
numClicks = 1;
152146
gd._mouseDownTime = newMouseDownTime;
@@ -157,8 +151,7 @@ dragElement.init = function init(options) {
157151
if(hasHover && !rightClick) {
158152
dragCover = coverSlip();
159153
dragCover.style.cursor = window.getComputedStyle(element).cursor;
160-
}
161-
else if(!hasHover) {
154+
} else if(!hasHover) {
162155
// document acts as a dragcover for mobile, bc we can't create dragcover dynamically
163156
dragCover = document;
164157
cursor = window.getComputedStyle(document.documentElement).cursor;
@@ -191,12 +184,21 @@ dragElement.init = function init(options) {
191184
dragElement.unhover(gd);
192185
}
193186

194-
if(gd._dragged && options.moveFn && !rightClick) options.moveFn(dx, dy);
187+
if(gd._dragged && options.moveFn && !rightClick) {
188+
gd._dragdata = {
189+
element: element,
190+
dx: dx,
191+
dy: dy
192+
};
193+
options.moveFn(dx, dy);
194+
}
195195

196196
return;
197197
}
198198

199199
function onDone(e) {
200+
delete gd._dragdata;
201+
200202
if(options.dragmode !== false) {
201203
e.preventDefault();
202204
document.removeEventListener('mousemove', onMove);
@@ -207,9 +209,8 @@ dragElement.init = function init(options) {
207209
document.removeEventListener('touchend', onDone);
208210

209211
if(hasHover) {
210-
Lib.removeElement(dragCover);
211-
}
212-
else if(cursor) {
212+
removeElement(dragCover);
213+
} else if(cursor) {
213214
dragCover.documentElement.style.cursor = cursor;
214215
cursor = null;
215216
}
@@ -228,8 +229,7 @@ dragElement.init = function init(options) {
228229

229230
if(gd._dragged) {
230231
if(options.doneFn) options.doneFn();
231-
}
232-
else {
232+
} else {
233233
if(options.clickFn) options.clickFn(numClicks, initialEvent);
234234

235235
// If we haven't dragged, this should be a click. But because of the
@@ -258,10 +258,8 @@ dragElement.init = function init(options) {
258258
}
259259
}
260260

261-
finishDrag(gd);
262-
261+
gd._dragging = false;
263262
gd._dragged = false;
264-
265263
return;
266264
}
267265
};
@@ -286,11 +284,6 @@ function coverSlip() {
286284

287285
dragElement.coverSlip = coverSlip;
288286

289-
function finishDrag(gd) {
290-
gd._dragging = false;
291-
if(gd._replotPending) Registry.call('plot', gd);
292-
}
293-
294287
function pointerOffset(e) {
295288
return mouseOffset(
296289
e.changedTouches ? e.changedTouches[0] : e,

src/components/drawing/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ drawing.setClipUrl = function(s, localId, gd) {
10281028
var context = gd._context;
10291029
var baseUrl = context._exportedPlot ? '' : (context._baseUrl || '');
10301030

1031-
s.attr('clip-path', 'url(' + baseUrl + '#' + localId + ')');
1031+
s.attr('clip-path', 'url(\'' + baseUrl + '#' + localId + '\')');
10321032
};
10331033

10341034
drawing.getTranslate = function(element) {

src/components/fx/hover.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,10 @@ exports.multiHovers = function multiHovers(hoverItems, opts) {
214214
// Fix vertical overlap
215215
var tooltipSpacing = 5;
216216
var lastBottomY = 0;
217+
var anchor = 0;
217218
hoverLabel
218219
.sort(function(a, b) {return a.y0 - b.y0;})
219-
.each(function(d) {
220+
.each(function(d, i) {
220221
var topY = d.y0 - d.by / 2;
221222

222223
if((topY - tooltipSpacing) < lastBottomY) {
@@ -226,12 +227,16 @@ exports.multiHovers = function multiHovers(hoverItems, opts) {
226227
}
227228

228229
lastBottomY = topY + d.by + d.offset;
229-
});
230230

231+
if(i === opts.anchorIndex || 0) anchor = d.offset;
232+
})
233+
.each(function(d) {
234+
d.offset -= anchor;
235+
});
231236

232237
alignHoverText(hoverLabel, fullOpts.rotateLabels);
233238

234-
return hoverLabel.node();
239+
return hoverLabel;
235240
};
236241

237242
// The actual implementation is here:

src/components/modebar/manage.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ function getButtonGroups(gd, buttonsToRemove, buttonsToAdd, showSendToCloud) {
8686
var hasTernary = fullLayout._has('ternary');
8787
var hasMapbox = fullLayout._has('mapbox');
8888
var hasPolar = fullLayout._has('polar');
89+
var hasSankey = fullLayout._has('sankey');
8990
var allAxesFixed = areAllAxesFixed(fullLayout);
9091

9192
var groups = [];
@@ -139,6 +140,9 @@ function getButtonGroups(gd, buttonsToRemove, buttonsToAdd, showSendToCloud) {
139140
else if(hasPie) {
140141
hoverGroup = ['hoverClosestPie'];
141142
}
143+
else if(hasSankey) {
144+
hoverGroup = ['hoverClosestCartesian', 'hoverCompareCartesian'];
145+
}
142146
else { // hasPolar, hasTernary
143147
// always show at least one hover icon.
144148
hoverGroup = ['toggleHover'];

src/lib/coerce.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var isNumeric = require('fast-isnumeric');
1212
var tinycolor = require('tinycolor2');
1313

1414
var baseTraceAttrs = require('../plots/attributes');
15-
var scales = require('../components/colorscale/scales');
15+
var colorscales = require('../components/colorscale/scales');
1616
var DESELECTDIM = require('../constants/interactions').DESELECTDIM;
1717

1818
var nestedProperty = require('./nested_property');
@@ -164,7 +164,7 @@ exports.valObjectMeta = {
164164
colorscale: {
165165
description: [
166166
'A Plotly colorscale either picked by a name:',
167-
'(any of', Object.keys(scales.scales).join(', '), ')',
167+
'(any of', Object.keys(colorscales.scales).join(', '), ')',
168168
'customized as an {array} of 2-element {arrays} where',
169169
'the first element is the normalized color level value',
170170
'(starting at *0* and ending at *1*),',
@@ -173,7 +173,7 @@ exports.valObjectMeta = {
173173
requiredOpts: [],
174174
otherOpts: ['dflt'],
175175
coerceFunction: function(v, propOut, dflt) {
176-
propOut.set(scales.get(v, dflt));
176+
propOut.set(colorscales.get(v, dflt));
177177
}
178178
},
179179
angle: {

0 commit comments

Comments
 (0)