Skip to content

Commit 458d111

Browse files
committed
fix text dirty rect considered when text in host
1 parent 4e721ed commit 458d111

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

src/canvas/Layer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ export default class Layer extends Eventful {
269269
* if it's currently on the canvas and needs repaint this frame
270270
* or not painted this frame.
271271
*/
272-
const shouldPaint = el.shouldBePainted(viewWidth, viewHeight, true, true);
272+
const shouldPaint = el.shouldBePainted(viewWidth, viewHeight, true, true, true);
273273
const prevRect = el.__isRendered && ((el.__dirty & REDRAW_BIT) || !shouldPaint)
274274
? el.getPrevPaintRect()
275275
: null;
@@ -311,7 +311,7 @@ export default class Layer extends Eventful {
311311
* rect if and only if it's not painted this frame and was
312312
* previously painted on the canvas.
313313
*/
314-
const shouldPaint = el.shouldBePainted(viewWidth, viewHeight, true, true);
314+
const shouldPaint = el.shouldBePainted(viewWidth, viewHeight, true, true, true);
315315
if (el && (!shouldPaint || !el.__zr) && el.__isRendered) {
316316
// el was removed
317317
const prevRect = el.getPrevPaintRect();

src/canvas/graphic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ export function brush(
615615
) {
616616
const m = el.transform;
617617

618-
if (!el.shouldBePainted(scope.viewWidth, scope.viewHeight, false, false)) {
618+
if (!el.shouldBePainted(scope.viewWidth, scope.viewHeight, false, false, false)) {
619619
// Needs to mark el rendered.
620620
// Or this element will always been rendered in progressive rendering.
621621
// But other dirty bit should not be cleared, otherwise it cause the shape

src/graphic/Displayable.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ class Displayable<Props extends DisplayableProps = DisplayableProps> extends Ele
195195
viewWidth: number,
196196
viewHeight: number,
197197
considerClipPath: boolean,
198-
considerAncestors: boolean
198+
considerAncestors: boolean,
199+
considerHostTarget: boolean
199200
) {
200201
const m = this.transform;
201202
if (
@@ -234,6 +235,23 @@ class Displayable<Props extends DisplayableProps = DisplayableProps> extends Ele
234235
}
235236
}
236237

238+
// consider host target
239+
if (
240+
considerAncestors
241+
&& considerHostTarget
242+
&& this.parent
243+
&& this.parent.__hostTarget
244+
) {
245+
let hostTarget = this.parent.__hostTarget;
246+
let parent = hostTarget;
247+
while (parent) {
248+
if (parent.ignore) {
249+
return false;
250+
}
251+
parent = parent.parent;
252+
}
253+
}
254+
237255
return true;
238256
}
239257

0 commit comments

Comments
 (0)