make layer type optional in props?
map.U.addCircleLayer('trees-circle', 'trees', {
circleColor: 'green', // paint property
circleRadius: ['interpolate', ['zoom'], 12, 3, 15, 5], // paint property
circleSortKey: ['get', 'tree-sort-key'], // layout property
filter: ['!=', 'type', 'stump'], // other property
});
Proposal to make the layer prefix optional in all props. The props above would read color, radius, and sortKey.
Only when disambiguating multiple props of the same kind (stroke- and circle-color in circle layers, icon-, text-, and halo-color in symbol layers, etc) will prefixes be needed. In those cases, the nonprefixed form will refer to the word in the layer type ("color" will refer to circle-color and "width" to line-width)
Yeah, interesting idea. I think personally I probably wouldn't use it much, due to the ambiguities. And also that semantic differences start to get conflated - line-offset has a bit of a different meaning from icon-offset.
But I'd be happy to accept a PR.
Not sure what should happen with ambiguous properties like offset in a symbol layer. Probably it shouldn't translate to anything.