Skip to content

Commit

Permalink
Merge pull request plotly#454 from plotly/illustrator-compatibility
Browse files Browse the repository at this point in the history
Illustrator compatibility
  • Loading branch information
mdtusz committed Apr 21, 2016
2 parents bb8137c + 97dc399 commit 3180b12
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/plots/geo/geo.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,7 @@ proto.adjustLayout = function(geoLayout, graphSize) {
width: geoLayout._width,
height: geoLayout._height
})
.style({
'fill': geoLayout.bgcolor,
'stroke-width': 0
});
.call(Color.fill, geoLayout.bgcolor);
};

proto.drawTopo = function(selection, layerName, geoLayout) {
Expand Down
5 changes: 5 additions & 0 deletions src/snapshot/tosvg.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ module.exports = function toSVG(gd, format) {
}
}

// remove draglayer for Adobe Illustrator compatibility
if(fullLayout._draggers) {
fullLayout._draggers.node().remove();
}

// in case the svg element had an explicit background color, remove this
// we want the rect to get the color so it's the right size; svg bg will
// fill whatever container it's displayed in regardless of plot size.
Expand Down
Binary file modified test/image/baselines/geo_bg-color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions test/jasmine/tests/color_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,34 @@ describe('Test color:', function() {
expect(container2).toEqual(expectedContainer2);
});
});

describe('fill', function() {

it('should call style with both fill and fill-opacity', function() {
var mockElement = {
style: function(object) {
expect(object.fill).toBe('rgb(255, 255, 0)');
expect(object['fill-opacity']).toBe(0.5);
}
};

Color.fill(mockElement, 'rgba(255,255,0,0.5');
});

});

describe('stroke', function() {

it('should call style with both fill and fill-opacity', function() {
var mockElement = {
style: function(object) {
expect(object.stroke).toBe('rgb(255, 255, 0)');
expect(object['stroke-opacity']).toBe(0.5);
}
};

Color.stroke(mockElement, 'rgba(255,255,0,0.5');
});

});
});

0 comments on commit 3180b12

Please sign in to comment.