Skip to content

Commit 3180b12

Browse files
committed
Merge pull request #454 from plotly/illustrator-compatibility
Illustrator compatibility
2 parents bb8137c + 97dc399 commit 3180b12

File tree

4 files changed

+36
-4
lines changed

4 files changed

+36
-4
lines changed

src/plots/geo/geo.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,7 @@ proto.adjustLayout = function(geoLayout, graphSize) {
308308
width: geoLayout._width,
309309
height: geoLayout._height
310310
})
311-
.style({
312-
'fill': geoLayout.bgcolor,
313-
'stroke-width': 0
314-
});
311+
.call(Color.fill, geoLayout.bgcolor);
315312
};
316313

317314
proto.drawTopo = function(selection, layerName, geoLayout) {

src/snapshot/tosvg.js

+5
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ module.exports = function toSVG(gd, format) {
105105
}
106106
}
107107

108+
// remove draglayer for Adobe Illustrator compatibility
109+
if(fullLayout._draggers) {
110+
fullLayout._draggers.node().remove();
111+
}
112+
108113
// in case the svg element had an explicit background color, remove this
109114
// we want the rect to get the color so it's the right size; svg bg will
110115
// fill whatever container it's displayed in regardless of plot size.

test/image/baselines/geo_bg-color.png

96 Bytes
Loading

test/jasmine/tests/color_test.js

+30
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,34 @@ describe('Test color:', function() {
145145
expect(container2).toEqual(expectedContainer2);
146146
});
147147
});
148+
149+
describe('fill', function() {
150+
151+
it('should call style with both fill and fill-opacity', function() {
152+
var mockElement = {
153+
style: function(object) {
154+
expect(object.fill).toBe('rgb(255, 255, 0)');
155+
expect(object['fill-opacity']).toBe(0.5);
156+
}
157+
};
158+
159+
Color.fill(mockElement, 'rgba(255,255,0,0.5');
160+
});
161+
162+
});
163+
164+
describe('stroke', function() {
165+
166+
it('should call style with both fill and fill-opacity', function() {
167+
var mockElement = {
168+
style: function(object) {
169+
expect(object.stroke).toBe('rgb(255, 255, 0)');
170+
expect(object['stroke-opacity']).toBe(0.5);
171+
}
172+
};
173+
174+
Color.stroke(mockElement, 'rgba(255,255,0,0.5');
175+
});
176+
177+
});
148178
});

0 commit comments

Comments
 (0)