Skip to content

Commit

Permalink
Merge pull request #1002 from ecomfe/fix-18194
Browse files Browse the repository at this point in the history
fix(svg): duplicate id for background rect with multiple charts
  • Loading branch information
plainheart authored Nov 16, 2023
2 parents 78f84fd + 8c6b137 commit 2c11063
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/canvas/Layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ export default class Layer extends Eventful {
* rect if and only if it's not painted this frame and was
* previously painted on the canvas.
*/
const shouldPaint = el.shouldBePainted(viewWidth, viewHeight, true, true);
const shouldPaint = el && el.shouldBePainted(viewWidth, viewHeight, true, true);
if (el && (!shouldPaint || !el.__zr) && el.__isRendered) {
// el was removed
const prevRect = el.getPrevPaintRect();
Expand Down
3 changes: 1 addition & 2 deletions src/svg/Painter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,7 @@ function createBackgroundVNode(
width,
height,
x: '0',
y: '0',
id: '0'
y: '0'
}
);
if (isGradient(backgroundColor)) {
Expand Down
3 changes: 1 addition & 2 deletions test/svg-backgroundColor.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
}
});
zr.add(txt);

var linearGradient = new zrender.LinearGradient();
linearGradient.addColorStop(0, '#a598e1');
linearGradient.addColorStop(1, '#14c4ba');
Expand Down Expand Up @@ -95,7 +95,6 @@
else {
bg = text = 'none';
}
console.log(text);
zr.setBackgroundColor(bg);
txt.setStyle({ text: 'SVG BackgroundColor: ' + text });
i++;
Expand Down

0 comments on commit 2c11063

Please sign in to comment.