0.4.0 • Published 5 years ago

ember-bing-maps v0.4.0

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

ember-bing-maps

Installation

ember install ember-bing-maps

Usage

{{bing-map 
  options=options
  pins=pins
  eventHandlers=eventHandlers
  infoBoxes=infoBoxes
}}

options

Generally follows bing maps config with some exceptions. All booleans and numbers are passed through mostly untouched. Enums and Objects are constructed inside ember-bing-maps to avoid the race condition of async loading and the global Microsoft.Maps lib.

Please see BingMaps docs for more details on options MapOptions ViewOptions

keytypevaluesdefault valuedescription
birdseyeFallbackobject--Used in case the birdseye view is not available to map's location
birdseyeFallback.typestringSee mapType below'aerial'Fallback to different map type
birdseyeFallback.zoomobject1-1915Zoom level to fallback onto
birdseyeFallback.navBarModestring'minified', 'compact', 'default''compact'Menu type to fallback onto
birdseyeFallback.navBarOrientationstring'horizontal', 'vertical''vertical'Menu orietation to fallback onto
defaultCenterobject-A rectangle around the USAUsed to construct a LocationRect in case no pins are configured
enableClickableLogobooleantrue/falsetrueMakes bing logo not clickable
mapTypestring'aerial', 'road', 'birdseye', ...'road'The name of the map type to load with. See MapTypeId
mapTypeHoverbooleantrue/falsefalseadd mouse over menu aka disableMapTypeSelectorMouseOver
navBarModestring'minified', 'compact', 'default''minified'Menu mode, NOTE: some modes are buggy in different mapTypes..
navBarOrientationstring'horizontal', 'vertical''vertical'Used in case the birdseye view is not available to map's location
paddinginteger*20Amount of pixels to pad around the bounds of the map view
showMapTypeSelectorbooleantrue/falsetrueShow map type selector in menu
showTrafficButtonbooleantrue/falsefalseShow traffic view button
supportedMapTypesarray of mapType stringsSee MapTypeId['road', 'aerial', 'streetside', 'birdseye']Add more map types to the map type selector
zoominteger1-1910Maps starting zoom position, higher => more zoom

pins

An array of coordinates with Options

Example:

[{
  latitude: 47.603791,
  longitude:  -122.334055,
  options: {
    icon: '/assets/img/location-pin.png',
    // This is used for eventHandlerss.pins, drop in any metadata needed for event callback.
    metadata: {
      title: 'mySpecialTitle'
    }
  }
}]

eventHandlers

An object of event handlers to be added (for now just on pins). Arguments passed to handlers are (event, infoBox, map). This allows for manipulation to the map and infoBox at the user's discretion. Note the infoBox is shared across the map

List of supported events:

Example:

eventHandlers: {
  pin: {
    click: (e, bingMapCtx) => {
      let { map, infoBox, customInfoBoxes } = getProperties(bingMapCtx, 'map', 'infoBox', 'customInfoBoxes');
      if (e.metadata.title === 'mySpecialPin') {
        let mapType = bingMapCtx.Microsoft.getMapTypeId();
        if (mapType === bingMapCtx.Microsoft.Maps.MapTypeId.aerial) {
          // do something interesting?
        }
      }
    }
  }
}

infoBoxes

Used to generate specific custom infoBoxes. We take the infoBoxTemplate and replace the {description} with InfoBox Class InfoBox Options

Example:

[{
  location: {
    latitude: 37.905249, 
    longitude: -85.927439
  },
  options: {
    htmlContent: `
      <div class="ember-bing-maps-dialogue-box">
        'X marks the spot.'
      </div>`,
    closeDelayTime: 100
  }
}]

Contributing

Installation

  • git clone <repository-url> this repository
  • cd ember-bing-maps
  • npm install

Running

Running Tests

  • npm test (Runs ember try:each to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit https://ember-cli.com/.

0.4.0

5 years ago

0.3.0

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.5

5 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago