Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dirtyRect): text dirty rect considered when text in host #891

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

linghaoSu
Copy link

Why

when enabling dirty rect, and then clicking the button in the toolbox, the zrender consider where should to repainted, but does not consider text when they are hosted in another element, so, maybe we should consider ignore textElment when they hosted in other element and the host element that is ignored.

Before

image

After

image

@@ -234,6 +235,23 @@ class Displayable<Props extends DisplayableProps = DisplayableProps> extends Ele
}
}

// consider host target
if (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can treat __hostTarget as a special parent and doing both check in the

let parent = this.parent;

if (considerAncestors) {
      let node = this;
      while (node) {
          if (node.ignore) {
              return false;
          }
          node = node.parent || node.__hostTarget;
      }
  }

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, I agree with this way, we don't need to modify the api of shouldBePainted, I have fixed this using these codes. Please review again.

@linghaoSu
Copy link
Author

hi, @pissang Is there anything else wrong with this pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

useDirtyRect = true and saving image shows "Save as Image" label
2 participants