Automatically resizing to fit

This commit is contained in:
Will Marshall
2014-06-05 16:49:01 +10:00
parent 5ffb8decf5
commit b1b80a1e39
4 changed files with 19 additions and 7 deletions

View File

@@ -6,4 +6,3 @@ Darkswarm.controller "MapCtrl", ($scope, MapConfiguration, OfnMap)->
longitude: 144.743663
zoom: 8
styles: MapConfiguration.options

View File

@@ -0,0 +1,10 @@
Darkswarm.directive "fillVertical", ($window)->
restrict: 'A'
link: (scope, element, attrs)->
setSize = ->
element.css "height", ($window.innerHeight - element.offset().top)
setSize()
angular.element($window).bind "resize", ->
setSize()

View File

@@ -1,5 +1,7 @@
// Place all the styles related to the map controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
.angular-google-map-container
height: 600px
.ofn-map-container
map, .angular-google-map-container, google-map, .angular-google-map
display: block
height: 100%

View File

@@ -3,10 +3,11 @@
= inject_json "enterprisesForMap" , "enterprises_for_map", collection: @enterprises
%map{"ng-controller" => "MapCtrl"}
%google-map{center: "map.center", zoom: "map.zoom", styles: "map.styles", draggable: "true"}
.ofn-map-container{"fill-vertical" => true}
%map{"ng-controller" => "MapCtrl"}
%google-map{center: "map.center", zoom: "map.zoom", styles: "map.styles", draggable: "true"}
%markers{models: "OfnMap.enterprises", fit: "true",
coords: "'self'", icon: "'icon'", click: "'reveal'"}
%markers{models: "OfnMap.enterprises", fit: "true",
coords: "'self'", icon: "'icon'", click: "'reveal'"}