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
mbostock
left a comment
There was a problem hiding this comment.
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