Skip to content

v1.9.0

Compare
Choose a tag to compare
@KaiHuebner KaiHuebner released this 17 Jun 12:49
· 37 commits to main since this release

Add Functionality

Optional simplified style definition

  • No need to separate styles into paint and layout properties
  • Properties names can be in camelCase instead of dash-case (eg.: fill-translate-anchor --> fillTranslateAnchor)
  • Prefix type in style properties can be omitted (eg.: fill-color --> color)
    • For symbols you still need the icon and text prefix

Normal style

style={{
  type: 'circle',
  paint: {
    'circle-radius': ['*', ['get', 'mag'], 2],
    'circle-color': [
      'match',
      ['get', 'tsunami'],
      0,
      '#F00',
      1,
      '#03A',
      '#CCC',
    ],
    'circle-opacity': 0.5,
    'circle-stroke-width': 0.25,
    'circle-pitch-alignment': 'map',
  },
  layout: {
    visibility: true
  }
}}

Simplified Style

style={{
  type: 'circle',
  radius: ['*', ['get', 'mag'], 2],
  color: ['match', ['get', 'tsunami'], 0, '#F00', 1, '#03A', '#CCC'],
  opacity: 0.5,
  strokeWidth: 0.25,
  pitchAlignment: 'map',
  visibility: true
}}

This should make it easier to save styles as JSON.