Skip to content

Commit 5e4bb1a

Browse files
authored
Merge pull request #1306 from plotly/range-slider-eps-pdf
Fix range slider svg / eps / pdf exports
2 parents 96f1e95 + 09a807d commit 5e4bb1a

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

src/components/rangeslider/draw.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,9 @@ function drawRangePlot(rangeSlider, gd, axisOpts, opts) {
377377

378378
Cartesian.rangePlot(gd, plotinfo, filterRangePlotCalcData(calcData, id));
379379

380-
if(isMainPlot) plotinfo.bg.call(Color.fill, opts.bgcolor);
380+
// no need for the bg layer,
381+
// drawBg handles coloring the background
382+
if(isMainPlot) plotinfo.bg.remove();
381383
});
382384
}
383385

@@ -404,10 +406,9 @@ function drawMasks(rangeSlider, gd, axisOpts, opts) {
404406
.classed(constants.maskMinClassName, true)
405407
.attr({ x: 0, y: 0 });
406408

407-
maskMin.attr({
408-
height: opts._height,
409-
fill: constants.maskColor
410-
});
409+
maskMin
410+
.attr('height', opts._height)
411+
.call(Color.fill, constants.maskColor);
411412

412413
var maskMax = rangeSlider.selectAll('rect.' + constants.maskMaxClassName)
413414
.data([0]);
@@ -416,13 +417,14 @@ function drawMasks(rangeSlider, gd, axisOpts, opts) {
416417
.classed(constants.maskMaxClassName, true)
417418
.attr('y', 0);
418419

419-
maskMax.attr({
420-
height: opts._height,
421-
fill: constants.maskColor
422-
});
420+
maskMax
421+
.attr('height', opts._height)
422+
.call(Color.fill, constants.maskColor);
423423
}
424424

425425
function drawSlideBox(rangeSlider, gd, axisOpts, opts) {
426+
if(gd._context.staticPlot) return;
427+
426428
var slideBox = rangeSlider.selectAll('rect.' + constants.slideBoxClassName)
427429
.data([0]);
428430

@@ -483,6 +485,8 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) {
483485

484486
// <g grabarea />
485487

488+
if(gd._context.staticPlot) return;
489+
486490
var grabAreaFixAttrs = {
487491
width: constants.grabAreaWidth,
488492
y: 0,

test/image/export_test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ var FORMATS = ['svg', 'pdf', 'eps'];
1919

2020
// non-exhaustive list of mocks to test
2121
var DEFAULT_LIST = [
22-
'0', 'geo_first', 'gl3d_z-range', 'text_export', 'layout_image', 'gl2d_12'
22+
'0', 'geo_first', 'gl3d_z-range', 'text_export', 'layout_image', 'gl2d_12',
23+
'range_slider_initial_valid'
2324
];
2425

2526
// return dimensions [in px]

0 commit comments

Comments
 (0)