Skip to content

Commit aefdab1

Browse files
committed
Eslint, enhance props propagation
1 parent 314dfdc commit aefdab1

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

src/traces/parcoords/base_plot.js

+2-10
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ var d3 = require('d3');
1212
var Plots = require('../../plots/plots');
1313
var parcoordsPlot = require('./plot');
1414
var xmlnsNamespaces = require('../../constants/xmlns_namespaces');
15-
var c = require('./constants');
1615

1716
exports.name = 'parcoords';
1817

@@ -41,21 +40,14 @@ exports.toSVG = function(gd) {
4140
var canvases = root.filter(function(d, i) {return i === root.size() - 1;})
4241
.selectAll('.gl-canvas-context, .gl-canvas-focus');
4342

44-
function canvasToImage(d) {
43+
function canvasToImage() {
4544
var canvas = this;
4645
var imageData = canvas.toDataURL('image/png');
4746
var image = imageRoot.append('svg:image');
48-
var size = gd._fullLayout._size;
49-
var domain = gd._fullData[d.model.key].domain;
5047

5148
image.attr({
5249
xmlns: xmlnsNamespaces.svg,
53-
'xlink:href': imageData,
54-
x: size.l + size.w * domain.x[0] - c.overdrag,
55-
y: size.t + size.h * (1 - domain.y[1]),
56-
width: (domain.x[1] - domain.x[0]) * size.w + 2 * c.overdrag,
57-
height: (domain.y[1] - domain.y[0]) * size.h,
58-
preserveAspectRatio: 'none'
50+
'xlink:href': imageData
5951
});
6052
}
6153

src/traces/parcoords/lines.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,11 @@ module.exports = function(canvasGL, d, scatter) {
261261
}
262262
},
263263

264-
viewport: () => {
265-
return {
266-
x: model.pad.l - overdrag + model.layoutWidth * domain.x[0],
267-
y: model.pad.b + model.layoutHeight * domain.y[0],
268-
width: canvasWidth,
269-
height: canvasHeight
270-
}
264+
viewport: {
265+
x: regl.prop('viewportX'),
266+
y: regl.prop('viewportY'),
267+
width: regl.prop('viewportWidth'),
268+
height: regl.prop('viewportHeight')
271269
},
272270

273271
dither: false,
@@ -363,10 +361,16 @@ module.exports = function(canvasGL, d, scatter) {
363361

364362
colorClamp: colorClamp,
365363
scatter: scatter || 0,
364+
366365
scissorX: (I === leftmost ? 0 : x + overdrag) + (model.pad.l - overdrag) + model.layoutWidth * domain.x[0],
367366
scissorWidth: (I === rightmost ? canvasWidth - x + overdrag : panelSizeX + 0.5) + (I === leftmost ? x + overdrag : 0),
368367
scissorY: y + model.pad.b + model.layoutHeight * domain.y[0],
369-
scissorHeight: canvasPanelSizeY
368+
scissorHeight: canvasPanelSizeY,
369+
370+
viewportX: model.pad.l - overdrag + model.layoutWidth * domain.x[0],
371+
viewportY: model.pad.b + model.layoutHeight * domain.y[0],
372+
viewportWidth: canvasWidth,
373+
viewportHeight: canvasHeight
370374
};
371375
}
372376

0 commit comments

Comments
 (0)