Skip to content

Commit

Permalink
fix(svg): remove id
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovilia committed Nov 16, 2023
1 parent 4ca836e commit 1ee4156
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
6 changes: 2 additions & 4 deletions src/svg/Painter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class SVGPainter implements PainterBase {

const children: SVGVNode[] = [];

const bgVNode = this._bgVNode = createBackgroundVNode(this._id, width, height, this._backgroundColor, scope);
const bgVNode = this._bgVNode = createBackgroundVNode(width, height, this._backgroundColor, scope);
bgVNode && children.push(bgVNode);

// Ignore the root g if wan't the output to be more tight.
Expand Down Expand Up @@ -360,7 +360,6 @@ function createMethodNotSupport(method: string): any {
}

function createBackgroundVNode(
zrId: string,
width: number,
height: number,
backgroundColor: SVGPainterBackgroundColor,
Expand All @@ -375,8 +374,7 @@ function createBackgroundVNode(
width,
height,
x: '0',
y: '0',
id: zrId + '-bg'
y: '0'
}
);
if (isGradient(backgroundColor)) {
Expand Down
9 changes: 0 additions & 9 deletions test/svg-backgroundColor.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
</head>
<body>
<div id="main" style="width:100vw;height:100vh;"></div>

<h2>This should not have a rect with the same id as the above instance.</h2>
<div id="main2" style="width:100vw;height:100vh;"></div>
<div class="opt-bar">
<button onclick="updateBg()">Change Background</button>
<select id="repeat">
Expand Down Expand Up @@ -46,11 +43,6 @@ <h2>This should not have a rect with the same id as the above instance.</h2>
});
zr.add(txt);

var zr2 = zrender.init(document.getElementById('main2'), {
renderer: 'svg'
});
zr2.add(txt);

var linearGradient = new zrender.LinearGradient();
linearGradient.addColorStop(0, '#a598e1');
linearGradient.addColorStop(1, '#14c4ba');
Expand Down Expand Up @@ -104,7 +96,6 @@ <h2>This should not have a rect with the same id as the above instance.</h2>
bg = text = 'none';
}
zr.setBackgroundColor(bg);
zr2.setBackgroundColor(bg);
txt.setStyle({ text: 'SVG BackgroundColor: ' + text });
i++;
}
Expand Down

0 comments on commit 1ee4156

Please sign in to comment.