-
Notifications
You must be signed in to change notification settings - Fork 185
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 symbol set hint when fill is a constant currentColor #1830
Conversation
…still want to pass "currentColor" as a hint to the symbol scale closes #1462
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn’t our handling of fill and stroke be the same?
My understanding is that fill defaults to "none", and "currentColor" for fill is transformed into null in style.js because that's the SVG default for path fill. Line 109 in 1ff36a3
but for the hint, we want to actually send an explicit fill: "currentColor" as the hint that this symbol has a fill. The logic is different for stroke, which defaults to currentColor which is not transformed into null. |
Right. But I think it’s still asymmetric. In essence, we’re trying to materialize the global default fill or stroke into the hint: if there isn’t a fill channel, nor this.fill, then we’re using the implied default fill which is currentColor. And for stroke, the implied default is none. So the logic should instead be: symbolChannel.hint = {
fill: fillChannel
? fillChannel.value === symbolChannel.value
? "color"
: "currentColor"
: this.fill ?? "currentColor",
stroke: strokeChannel
? strokeChannel.value === symbolChannel.value
? "color"
: "currentColor"
: this.stroke ?? "none"
}; |
…q#1830) * when we specify fill: "currentColor", this.fill is undefined, but we still want to pass "currentColor" as a hint to the symbol scale closes observablehq#1462 * materialize default stroke, too --------- Co-authored-by: Mike Bostock <[email protected]>
when we specify fill: "currentColor", this.fill is undefined, but we still want to pass "currentColor" as a hint to the symbol scale
closes #1462