Skip to content
This repository has been archived by the owner on Apr 10, 2018. It is now read-only.

Styles local to layers #5

Closed
edenh opened this issue Apr 4, 2014 · 2 comments
Closed

Styles local to layers #5

edenh opened this issue Apr 4, 2014 · 2 comments

Comments

@edenh
Copy link
Contributor

edenh commented Apr 4, 2014

Opening this as a separate ticket as mapbox/mapbox-gl-js#356 is getting long.

An alternative to the current separation between layers and styles is to define the style inline, which might be a little easier to understand. The current separation is more readable for ordering, so maybe this can be an alternative syntax that builds the style classes.

I'm thinking something like this, where the two classes are 'default' and 'night':

{
  "buckets": [
    {
      "id": "background"
      "style": {
        "day": {
          "fill-color": "#fff"
        },
        "night": {
          "fill-color": "#333"
        }
      }
    },
    {
      "id": "osm-bright",
      "filter": {"source": "osm-bright"},
      "layers": [
        {
          "id": "waterway_other",
          "filter": {
            "layer": "waterway",
            "$or": [
              {"type": "ditch"},
              {"type": "drain"}
            ]
          },
          "style": {
            "day": {
              "line-color": "blue",
              "line-width": 5,
              "line-cap": "round"
            },
            "night": {
              "line-color": "black",
              "line-width": 4,
              "line-cap": "round"
            }
          }
        }
      ]
    }
  ]
}

cc @ansis @mourner @tmcw

@mourner
Copy link
Member

mourner commented Apr 4, 2014

Adding or removing a class in this case would be hell. :) And a lot more verbose in case of big styles like OSM Bright as you would specify default for every bucket. And of course we loose the clarity of structure. I think separation is better.

@edenh
Copy link
Contributor Author

edenh commented Apr 4, 2014

Yea, makes sense.

@edenh edenh closed this as completed Apr 4, 2014
lucaswoj added a commit that referenced this issue Dec 17, 2016
Minor improvements to functions
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants