Sha256: d23ed30622ed57532a129f44e351c1ced4489a44133277eb62cc6fdf9c4935a7
Contents?: true
Size: 1.96 KB
Versions: 1
Compression:
Stored size: 1.96 KB
Contents
class ADF.Minimap.Views.Main extends ADF.MVC.Views.Base mapOptions: {} map_id: "adf_minimap_canvas" constructor: (options) -> super(options) @model = new ADF.Minimap.Models.Minimap(@mapOptions) @map_id = options.map_id if options.map_id render: () -> @containerArea = @make("div", {"id" : @map_id} ) @setElement( @containerArea ) @ return this renderMap: -> @bindResizeEvents() @model.initGMap(@map_id) @tooltip = new ADF.Minimap.Views.Tooltip({map: @getMap(), containerArea: @containerArea }) @resize() @initTooltip() @onRenderCompleted() initTooltip: () -> $(@containerArea).append( @tooltip.render().el ) bindResizeEvents: -> $(window).resize => @resize() $(document).ready => @resize() resize: -> $(@containerArea).css({"position" : "relative", "height" : "100%", "width" : "100%"}) google.maps.event.trigger( @model.getGMap(), "resize") if @model.getGMap() getMap: () -> @model getGMap: () -> @model.getGMap() setCenter: (latLng) -> @model.setCenter(latLng) setMapTypeId: (mapTypeId) -> @model.setMapTypeId(mapTypeId) setCenterWithOffset: (position, offsetx, offsety) -> @model.setCenter(position) zoomLevel = @model.getGMap().getZoom() max = Math.pow(2,zoomLevel) * 256; lng = -(offsetx / max) * 100 + position.lng() lat = -(offsety / max) * 100 + position.lat() pos = new google.maps.LatLng(lat, lng) @model.setCenter(pos) fitBounds: (bounds_array, centerWithOffset) -> if bounds_array bounds = new google.maps.LatLngBounds() _.each bounds_array, (marker) => bounds.extend(new google.maps.LatLng(marker.lat, marker.lng)) @model.fitBounds(bounds) @model.getGMap().setZoom(@model.getGMap().getZoom() - 1) @setCenterWithOffset(@model.getGMap().getCenter(), 0, -300) if centerWithOffset # Callback methods onRenderCompleted: () ->
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
socmap_adf-0.0.10 | lib/assets/javascripts/socmap_adf/modules/minimap/views/main.js.coffee |