diff options
author | Marius Halden <marius.h@lden.org> | 2017-05-28 21:31:42 +0200 |
---|---|---|
committer | Marius Halden <marius.h@lden.org> | 2017-05-28 21:31:42 +0200 |
commit | 987124b09a32248414faf4d0d6615d43b29ac6f6 (patch) | |
tree | a549db8af723c981d3b346e855f25d6fd5ff8aa7 /web/js/map-google-ol.js | |
parent | dbf56159e44c1560a413022451bf1a1c4cb22a52 (diff) | |
parent | a085b63ce09f87e83b75cda9b9cd08aadfe75d61 (diff) |
Merge tag 'v2.0.4' into fiksgatami-dev
Diffstat (limited to 'web/js/map-google-ol.js')
-rw-r--r-- | web/js/map-google-ol.js | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/web/js/map-google-ol.js b/web/js/map-google-ol.js index 96ec6fe9b..7369a8e9f 100644 --- a/web/js/map-google-ol.js +++ b/web/js/map-google-ol.js @@ -33,8 +33,24 @@ fixmystreet.maps.config = function() { zoomDuration: 10 }; + var road_layer = {}; // Empty object defaults to standard road layer + + function apply_map_styles() { + var styledMapType = new google.maps.StyledMapType(fixmystreet_google_maps_custom_style); + this.mapObject.mapTypes.set('styled', styledMapType); + this.mapObject.setMapTypeId('styled'); + } + // If you want to apply a custom style to the road map (for example from + // a service such as snazzymaps.com) then define that style as a top-level + // variable called fixmystreet_google_maps_custom_style (you might have to + // override the maps/google-ol.html template to include your own JS file) + // and it'll automatically be applied. + if (typeof fixmystreet_google_maps_custom_style !== 'undefined') { + road_layer = { type: 'styled', eventListeners: { added: apply_map_styles } }; + } + fixmystreet.layer_options = [ - {}, + road_layer, { type: google.maps.MapTypeId.HYBRID } ]; }; |