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

Set background fill style for each declutter label #11011

Merged
merged 2 commits into from May 6, 2020

Conversation

mike-000
Copy link
Contributor

@mike-000 mike-000 commented May 5, 2020

Fixes #10949

fillStyle needs to be set for each label to handle declutter groups containing different styles

@@ -280,6 +280,7 @@ class Executor {
context.lineTo.apply(context, p1);
if (fillInstruction) {
this.alignFill_ = /** @type {boolean} */ (fillInstruction[2]);
context.fillStyle = /** @type {import("../../colorlike.js").ColorLike} */ (fillInstruction[1]);
Copy link
Member

Choose a reason for hiding this comment

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

Without a context.save/restore, doesn't this affect subsequent polygon fills?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would if the the color isn't set each time, but .fill_() seems to rely on that as it is already doing save and restore for rotation https://github.com/openlayers/openlayers/blob/master/src/ol/render/canvas/Executor.js#L1038

Copy link
Member

Choose a reason for hiding this comment

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

Well, since this seems to be an issue only when decluttering, I guess you are right. But then again, wouldn't it be anough to set the fillStyle here only when we're decluttering?

@mike-000 mike-000 changed the title Set background fill style for each label Set background fill style for each declutter label May 6, 2020
Copy link
Member

@ahocevar ahocevar left a comment

Choose a reason for hiding this comment

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

Looks good now, thanks!

@ahocevar ahocevar merged commit 24c453c into openlayers:master May 6, 2020
@mike-000 mike-000 deleted the patch-3 branch July 18, 2020 12:34
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.

backgroundFill color not respected when declutter is used
2 participants