Skip to content
This repository was archived by the owner on Nov 30, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ module.exports = (grunt) ->
grunt.registerTask "coverage", ["clean:dist", "jshint", "mkdir", "coffee", "concat:libs", "replace", "concat:dist", "copy",
"uglify", "jasmine:coverage"]

grunt.registerTask 'default-no-specs', ["clean:dist", "jshint", "mkdir", "coffee", "concat:libs", "replace", "concat:dist", "copy", "uglify"]

grunt.registerTask 'offline', ['default-no-specs', 'watch:offline']

# Run the example page by creating a local copy of angular-google-maps.js
# and running a webserver on port 3100 with livereload. Web page is opened
# automatically in the default browser.
Expand Down
314 changes: 143 additions & 171 deletions dist/angular-google-maps.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions dist/angular-google-maps.min.js

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions grunt/options.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@ module.exports = (grunt) ->

test: {}
watch:
offline:
options:
livereload: true

files: [
"src/coffee/*.coffee", "src/coffee/**/*.coffee", "src/coffee/**/**/*.coffee",
"src/js/*.js", "src/js/**/*.js", "src/js/**/**/*.js", "spec/**/*.spec.coffee", "spec/coffee/helpers/**"#,
#"example/**"
]
tasks: ['default-no-specs']
all:
options:
livereload: true
Expand Down
2 changes: 1 addition & 1 deletion spec/coffee/helpers/initiator.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defaultMap =
longitude: 47
latitude: -27

window["Initiator".ns()] =
window["uiGmapInitiator"] =
initDirective: (toInit, apiSubjectClassName, thingsToInit = ['initAll'], map = defaultMap)->

injects = ['$compile', '$rootScope', '$timeout', 'Logger'.ns()]
Expand Down
10 changes: 5 additions & 5 deletions src/coffee/directives/api/drawing-manager.coffee
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
angular.module("google-maps.directives.api".ns()).factory "DrawingManager".ns(), [
"IDrawingManager".ns(), "DrawingManagerParentModel".ns(),
(IDrawingManager,DrawingManagerParentModel) ->
angular.module("uiGmapgoogle-maps.directives.api").factory "uiGmapDrawingManager", [
"uiGmapIDrawingManager", "uiGmapDrawingManagerParentModel",
(IDrawingManager, DrawingManagerParentModel) ->
_.extend IDrawingManager,
link: (scope, element, attrs, mapCtrl) ->
mapCtrl.getScope().deferred.promise.then (map) =>
new DrawingManagerParentModel scope,element,attrs, map
mapCtrl.getScope().deferred.promise.then (map) ->
new DrawingManagerParentModel scope, element, attrs, map
]
12 changes: 6 additions & 6 deletions src/coffee/directives/api/free-draw-polygons.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
- inject the draw function into a controllers scope so that controller can call the directive to draw on demand
- draw function creates the DrawFreeHandChildModel which manages itself
###
angular.module("google-maps.directives.api".ns())
.factory 'ApiFreeDrawPolygons'.ns(), ["Logger".ns(), 'BaseObject'.ns(), "CtrlHandle".ns(), "DrawFreeHandChildModel".ns(),
angular.module('uiGmapgoogle-maps.directives.api')
.factory 'uiGmapApiFreeDrawPolygons', ["uiGmapLogger", 'uiGmapBaseObject', "uiGmapCtrlHandle", "uiGmapDrawFreeHandChildModel",
($log, BaseObject, CtrlHandle, DrawFreeHandChildModel) ->
class FreeDrawPolygons extends BaseObject
@include CtrlHandle
restrict: 'EMA'
replace: true
require: '^' + 'GoogleMap'.ns()
require: '^' + 'uiGmapGoogleMap'
scope:
polygons: '='
draw: '='
Expand All @@ -19,9 +19,9 @@ angular.module("google-maps.directives.api".ns())
@mapPromise(scope, ctrl).then (map) =>
return $log.error "No polygons to bind to!" unless scope.polygons
return $log.error "Free Draw Polygons must be of type Array!" unless _.isArray scope.polygons
freeHand = new DrawFreeHandChildModel(map, scope.originalMapOpts)
freeHand = new DrawFreeHandChildModel map, scope.originalMapOpts
listener = undefined
scope.draw = () ->
scope.draw = ->
#clear watch only watch when we are finished drawing/engaging
listener?()
freeHand.engage(scope.polygons).then ->
Expand All @@ -36,4 +36,4 @@ angular.module("google-maps.directives.api".ns())
removals = _.differenceObjects oldValue, newValue
removals.forEach (p) ->
p.setMap null
]
]
10 changes: 5 additions & 5 deletions src/coffee/directives/api/i-control.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
- controller
- index
###
angular.module("google-maps.directives.api".ns())
.factory "IControl".ns(), [ "BaseObject".ns(), "Logger".ns(), "CtrlHandle".ns(), (BaseObject, Logger, CtrlHandle) ->
angular.module("uiGmapgoogle-maps.directives.api")
.factory "uiGmapIControl", [ "uiGmapBaseObject", "uiGmapLogger", "uiGmapCtrlHandle", (BaseObject, Logger, CtrlHandle) ->
class IControl extends BaseObject
@extend CtrlHandle
constructor: ->
@restrict = 'EA'
@replace = true
@require = '^' + 'GoogleMap'.ns()
@require = '^' + 'uiGmapGoogleMap'
@scope =
template: '@template'
position: '@position'
controller: '@controller'
index: '@index'
@$log = Logger

link: (scope, element, attrs, ctrl) =>
throw new Exception("Not implemented!!")
link: (scope, element, attrs, ctrl) ->
throw new Exception "Not implemented!!"
]
12 changes: 6 additions & 6 deletions src/coffee/directives/api/i-drawing-manager.coffee
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
angular.module("google-maps.directives.api".ns()).service "IDrawingManager".ns(), [ ->
restrict: "EA"
angular.module('uiGmapgoogle-maps.directives.api').service 'uiGmapIDrawingManager', [ ->
restrict: 'EA'
replace: true
require: '^' + 'GoogleMap'.ns()
require: '^' + 'uiGmapGoogleMap'
scope:
static: "@"
control: "="
options: "="
static: '@'
control: '='
options: '='
]
2 changes: 1 addition & 1 deletion src/coffee/directives/api/i-marker.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ angular.module("google-maps.directives.api".ns())
options: '=options'
events: '=events'
fit: '=fit'
idKey: '=idkey' #id key to bind to that makes a model unique, if it does not exist default to rebuilding all markers
idKey: '=idkey'
control: '=control'

IMarker.keys = _.keys IMarker.scopeKeys
Expand Down
38 changes: 19 additions & 19 deletions src/coffee/directives/api/i-polygon.coffee
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
angular.module("google-maps.directives.api".ns())
.factory "IPolygon".ns(), ["GmapUtil".ns(), "BaseObject".ns(), "Logger".ns(), "CtrlHandle".ns(),
angular.module('uiGmapgoogle-maps.directives.api')
.factory 'uiGmapIPolygon', ['uiGmapGmapUtil', 'uiGmapBaseObject', 'uiGmapLogger', 'uiGmapCtrlHandle',
(GmapUtil, BaseObject, Logger, CtrlHandle) ->
class IPolygon extends BaseObject
@include GmapUtil
@extend CtrlHandle
constructor: ->
restrict: "EMA"
restrict: 'EMA'
replace: true
require: '^' + 'GoogleMap'.ns()
require: '^' + 'uiGmapGoogleMap'
scope:
path: "=path"
stroke: "=stroke"
clickable: "="
draggable: "="
editable: "="
geodesic: "="
fill: "="
icons: "=icons"
visible: "="
static: "="
events: "="
zIndex: "=zindex"
fit: "="
control:"=control"
path: '=path'
stroke: '=stroke'
clickable: '='
draggable: '='
editable: '='
geodesic: '='
fill: '='
icons: '=icons'
visible: '='
static: '='
events: '='
zIndex: '=zindex'
fit: '='
control:'=control'

DEFAULTS: {}
$log: Logger
]
]
32 changes: 16 additions & 16 deletions src/coffee/directives/api/i-polyline.coffee
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
angular.module("google-maps.directives.api".ns())
.factory "IPolyline".ns(), ["GmapUtil".ns(), "BaseObject".ns(), "Logger".ns(), "CtrlHandle".ns(), (GmapUtil, BaseObject, Logger, CtrlHandle) ->
angular.module('uiGmapgoogle-maps.directives.api')
.factory 'uiGmapIPolyline', ['uiGmapGmapUtil', 'uiGmapBaseObject', 'uiGmapLogger', 'uiGmapCtrlHandle', (GmapUtil, BaseObject, Logger, CtrlHandle) ->
class IPolyline extends BaseObject
@include GmapUtil
@extend CtrlHandle
constructor: ()->
restrict: "EMA"
restrict: 'EMA'
replace: true
require: '^' + 'GoogleMap'.ns()
require: '^' + 'uiGmapGoogleMap'
scope:
path: "="
stroke: "="
clickable: "="
draggable: "="
editable: "="
geodesic: "="
icons: "="
visible: "="
static: "="
fit: "="
events: "="
path: '='
stroke: '='
clickable: '='
draggable: '='
editable: '='
geodesic: '='
icons: '='
visible: '='
static: '='
fit: '='
events: '='

DEFAULTS: {}
$log: Logger
]
]
24 changes: 12 additions & 12 deletions src/coffee/directives/api/i-rectangle.coffee
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
angular.module("google-maps.directives.api".ns()).service "IRectangle".ns(), [ ->
"use strict"
angular.module('uiGmapgoogle-maps.directives.api').service 'uiGmapIRectangle', [ ->
'use strict'
DEFAULTS = {}
restrict: "EMA"
require: '^' + 'GoogleMap'.ns()
restrict: 'EMA'
require: '^' + 'uiGmapGoogleMap'
replace: true
scope:
bounds: "="
stroke: "="
clickable: "="
draggable: "="
editable: "="
fill: "="
visible: "="
events: "="
bounds: '='
stroke: '='
clickable: '='
draggable: '='
editable: '='
fill: '='
visible: '='
events: '='
]
14 changes: 5 additions & 9 deletions src/coffee/directives/api/i-window.coffee
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
###
- interface directive for all window(s) to derive from
###
angular.module("uiGmapgoogle-maps.directives.api")
.factory "uiGmapIWindow", [
"uiGmapBaseObject", "uiGmapChildEvents", "uiGmapLogger", "uiGmapCtrlHandle",
angular.module('uiGmapgoogle-maps.directives.api')
.factory 'uiGmapIWindow', [
'uiGmapBaseObject', 'uiGmapChildEvents', 'uiGmapLogger', 'uiGmapCtrlHandle',
(BaseObject, ChildEvents, Logger, CtrlHandle) ->
class IWindow extends BaseObject
@include ChildEvents
Expand All @@ -13,18 +10,17 @@ angular.module("uiGmapgoogle-maps.directives.api")
@template = undefined
@transclude = true
@priority = -100
@require = '^' + 'GoogleMap'.ns()
@require = '^' + 'uiGmapGoogleMap'
@replace = true
@scope = {
coords: '=coords',
template: '=template',
templateUrl: '=templateurl',
templateParameter: '=templateparameter',
isIconVisibleOnClick: '=isiconvisibleonclick',
closeClick: '&closeclick', #scope glue to gmap InfoWindow closeclick
closeClick: '&closeclick',
options: '=options'
control: '=control'
#show is not part of options, (https://developers.google.com/maps/documentation/javascript/reference#InfoWindowOptions) we need it then
show: '=show'
}
@$log = Logger
Expand Down
26 changes: 12 additions & 14 deletions src/coffee/directives/api/managers/clusterer-marker-manager.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
angular.module("google-maps.directives.api.managers".ns())
.factory "ClustererMarkerManager".ns(), ["Logger".ns(), "FitHelper".ns(), "PropMap".ns(), ($log, FitHelper, PropMap) ->
angular.module('uiGmapgoogle-maps.directives.api.managers')
.factory 'uiGmapClustererMarkerManager', ['uiGmapLogger', 'uiGmapFitHelper', 'uiGmapPropMap', ($log, FitHelper, PropMap) ->
class ClustererMarkerManager extends FitHelper
@type = 'ClustererMarkerManager'
constructor: (gMap, opt_markers, opt_options, @opt_events) ->
Expand All @@ -8,29 +8,27 @@ angular.module("google-maps.directives.api.managers".ns())
self = @
@opt_options = opt_options
if opt_options? and opt_markers == undefined
@clusterer = new NgMapMarkerClusterer(gMap, undefined, opt_options)
@clusterer = new NgMapMarkerClusterer gMap, undefined, opt_options
else if opt_options? and opt_markers?
@clusterer = new NgMapMarkerClusterer(gMap, opt_markers, opt_options)
@clusterer = new NgMapMarkerClusterer gMap, opt_markers, opt_options
else
@clusterer = new NgMapMarkerClusterer(gMap)
@clusterer = new NgMapMarkerClusterer gMap
@propMapGMarkers = new PropMap() #keep in sync with cluster.markers_

@attachEvents @opt_events, "opt_events"
@attachEvents @opt_events, 'opt_events'

@clusterer.setIgnoreHidden(true)
@clusterer.setIgnoreHidden true
@noDrawOnSingleAddRemoves = true
$log.info(@)
$log.info @

checkKey: (gMarker) ->
unless gMarker.key?
msg = "gMarker.key undefined and it is REQUIRED!!"
msg = 'gMarker.key undefined and it is REQUIRED!!'
Logger.error msg

add: (gMarker)=>
@checkKey gMarker
exists = @propMapGMarkers.get(gMarker.key)?

@clusterer.addMarker(gMarker, @noDrawOnSingleAddRemoves)
@clusterer.addMarker gMarker, @noDrawOnSingleAddRemoves
@propMapGMarkers.put gMarker.key, gMarker
@checkSync()

Expand Down Expand Up @@ -76,14 +74,14 @@ angular.module("google-maps.directives.api.managers".ns())
@clearEvents @opt_internal_events
@clear()

fit: ()=>
fit: =>
super @getGMarkers(), @clusterer.getMap()

getGMarkers: =>
@clusterer.getMarkers().values()

checkSync: =>
throw "GMarkers out of Sync in MarkerClusterer" if @getGMarkers().length != @propMapGMarkers.length
throw 'GMarkers out of Sync in MarkerClusterer' if @getGMarkers().length != @propMapGMarkers.length

ClustererMarkerManager
]
4 changes: 2 additions & 2 deletions src/coffee/directives/api/managers/marker-manager.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
angular.module("google-maps.directives.api.managers".ns())
.factory "MarkerManager".ns(), ["Logger".ns(), "FitHelper".ns(), "PropMap".ns(), (Logger, FitHelper, PropMap) ->
angular.module("uiGmapgoogle-maps.directives.api.managers")
.factory "uiGmapMarkerManager", ["uiGmapLogger", "uiGmapFitHelper", "uiGmapPropMap", (Logger, FitHelper, PropMap) ->
class MarkerManager extends FitHelper
@include FitHelper
@type = 'MarkerManager'
Expand Down
2 changes: 1 addition & 1 deletion src/coffee/directives/api/map.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ angular.module("uiGmapgoogle-maps.directives.api")
bounds: scope.bounds

_m = new google.maps.Map(el.find("div")[1], mapOptions)
_m['_id'.ns()] = uuid.generate()
_m['uiGmap_id'] = uuid.generate()

dragging = false

Expand Down
Loading