0.0.5 • Published 1 year ago

@shenyong/mapbox-gl-styles v0.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

<< all controls

💅 @shenyong/mapbox-gl-styles

Control to change map style among provided.

npm i @shenyong/mapbox-gl-styles
import StylesControl from '@shenyong/mapbox-gl-styles';
import '@shenyong/mapbox-gl-styles/src/index.css';

map.addControl(new StylesControl(styles: {
  label: 'Streets',
  styleName: 'Mapbox Streets',
  styleUrl: 'mapbox://styles/mapbox/streets-v12',
}, {
  label: 'Satellite',
  styleName: 'Mapbox Satellite Streets',
  styleUrl: 'mapbox://sprites/mapbox/satellite-streets-v12',
}), 'top-left');

// or with compact view and default styles (streets and satellite)
map.addControl(new StylesControl({ compact: true }), 'top-left');

Use mapbox style.load event to redraw layers.

Options

styleName - is the root value of style's name property according to the specification.

export type Style = {
  label: string;
  styleName: string;
  styleUrl: string;
};

export type StylesControlOptions = {
  styles?: Style[] | undefined;
  onChange?: ((style: Style) => void) | undefined;
  compact?: boolean | undefined;
};
0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago

0.0.0

1 year ago