mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-22 14:22:21 +00:00
Improve opacity support
This commit is contained in:
parent
599491fa88
commit
cbe8f2d584
@ -13,7 +13,7 @@ export class EllipseConverter implements SvgConverter {
|
|||||||
|
|
||||||
const fill_opacity = node.attributes.getNamedItem("fill-opacity");
|
const fill_opacity = node.attributes.getNamedItem("fill-opacity");
|
||||||
if (fill) {
|
if (fill) {
|
||||||
drawing.fill_opacity = parseInt(fill_opacity.value, 10);
|
drawing.fill_opacity = parseFloat(fill_opacity.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const stroke = node.attributes.getNamedItem("stroke");
|
const stroke = node.attributes.getNamedItem("stroke");
|
||||||
|
@ -11,7 +11,7 @@ describe('RectConverter', () => {
|
|||||||
it('should parse attributes', () => {
|
it('should parse attributes', () => {
|
||||||
const node = document.createElement("rect");
|
const node = document.createElement("rect");
|
||||||
node.setAttribute("fill", "#ffffff");
|
node.setAttribute("fill", "#ffffff");
|
||||||
node.setAttribute("fill-opacity", "1.0");
|
node.setAttribute("fill-opacity", "0.7");
|
||||||
node.setAttribute("stroke", "#000000");
|
node.setAttribute("stroke", "#000000");
|
||||||
node.setAttribute("stroke-width", "2");
|
node.setAttribute("stroke-width", "2");
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ describe('RectConverter', () => {
|
|||||||
|
|
||||||
const drawing = rectConverter.convert(node);
|
const drawing = rectConverter.convert(node);
|
||||||
expect(drawing.fill).toEqual("#ffffff");
|
expect(drawing.fill).toEqual("#ffffff");
|
||||||
expect(drawing.fill_opacity).toEqual(1.0);
|
expect(drawing.fill_opacity).toEqual(0.7);
|
||||||
expect(drawing.stroke).toEqual("#000000");
|
expect(drawing.stroke).toEqual("#000000");
|
||||||
expect(drawing.stroke_width).toEqual(2.0);
|
expect(drawing.stroke_width).toEqual(2.0);
|
||||||
expect(drawing.width).toEqual(100);
|
expect(drawing.width).toEqual(100);
|
||||||
|
@ -13,7 +13,7 @@ export class RectConverter implements SvgConverter {
|
|||||||
|
|
||||||
const fill_opacity = node.attributes.getNamedItem("fill-opacity");
|
const fill_opacity = node.attributes.getNamedItem("fill-opacity");
|
||||||
if (fill) {
|
if (fill) {
|
||||||
drawing.fill_opacity = parseInt(fill_opacity.value, 10);
|
drawing.fill_opacity = parseFloat(fill_opacity.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const stroke = node.attributes.getNamedItem("stroke");
|
const stroke = node.attributes.getNamedItem("stroke");
|
||||||
|
@ -15,7 +15,7 @@ export class TextConverter implements SvgConverter {
|
|||||||
|
|
||||||
const fill_opacity = node.attributes.getNamedItem('fill-opacity');
|
const fill_opacity = node.attributes.getNamedItem('fill-opacity');
|
||||||
if (fill_opacity) {
|
if (fill_opacity) {
|
||||||
drawing.fill_opacity = +fill_opacity.value;
|
drawing.fill_opacity = parseFloat(fill_opacity.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const font_family = node.attributes.getNamedItem('font-family');
|
const font_family = node.attributes.getNamedItem('font-family');
|
||||||
|
Loading…
Reference in New Issue
Block a user