geolocation-marker
Advanced tools
Comparing version 2.0.4 to 2.0.5
@@ -1,16 +0,19 @@ | ||
(function(){/* | ||
geolocation-marker version 2.0.4 | ||
(function(){ | ||
/* | ||
geolocation-marker version 2.0.5 | ||
@copyright 2012, 2015 Chad Killingsworth | ||
@see https://github.com/ChadKillingsworth/geolocation-marker/blob/master/LICENSE.txt | ||
*/ | ||
'use strict';var b,d=this; | ||
function g(a,c,e){google.maps.MVCObject.call(this);this.a=this.b=null;this.g=-1;var f={clickable:!1,cursor:"pointer",draggable:!1,flat:!0,icon:{url:"https://chadkillingsworth.github.io/geolocation-marker/images/gpsloc.png",size:new google.maps.Size(34,34),scaledSize:new google.maps.Size(17,17),origin:new google.maps.Point(0,0),anchor:new google.maps.Point(8,8)},optimized:!1,position:new google.maps.LatLng(0,0),title:"Current location",zIndex:2};c&&(f=h(f,c));c={clickable:!1,radius:0,strokeColor:"1bb6ff", | ||
strokeOpacity:.4,fillColor:"61a0bf",fillOpacity:.4,strokeWeight:1,zIndex:1};e&&(c=h(c,e));this.b=new google.maps.Marker(f);this.a=new google.maps.Circle(c);google.maps.MVCObject.prototype.set.call(this,"accuracy",null);google.maps.MVCObject.prototype.set.call(this,"position",null);google.maps.MVCObject.prototype.set.call(this,"map",null);this.set("minimum_accuracy",null);this.set("position_options",{enableHighAccuracy:!0,maximumAge:1E3});this.a.bindTo("map",this.b);a&&this.f(a)} | ||
(function(){var a=google.maps.MVCObject;function c(){}c.prototype=a.prototype;g.prototype=new c;g.prototype.constructor=g;for(var e in a)if(d.Object.defineProperties){var f=d.Object.getOwnPropertyDescriptor(a,e);void 0!==f&&d.Object.defineProperty(g,e,f)}else g[e]=a[e]})();b=g.prototype;b.set=function(a,c){if(k.test(a))throw"'"+a+"' is a read-only property.";"map"===a?this.f(c):google.maps.MVCObject.prototype.set.call(this,a,c)};b.i=function(){return this.get("map")};b.l=function(){return this.get("position_options")}; | ||
b.w=function(a){this.set("position_options",a)};b.c=function(){return this.get("position")};b.m=function(){return this.get("position")?this.a.getBounds():null};b.j=function(){return this.get("accuracy")};b.h=function(){return this.get("minimum_accuracy")};b.v=function(a){this.set("minimum_accuracy",a)}; | ||
b.f=function(a){google.maps.MVCObject.prototype.set.call(this,"map",a);a?navigator.geolocation&&(this.g=navigator.geolocation.watchPosition(this.A.bind(this),this.o.bind(this),this.l())):(this.b.unbind("position"),this.a.unbind("center"),this.a.unbind("radius"),google.maps.MVCObject.prototype.set.call(this,"accuracy",null),google.maps.MVCObject.prototype.set.call(this,"position",null),navigator.geolocation.clearWatch(this.g),this.g=-1,this.b.setMap(a))};b.u=function(a){this.b.setOptions(h({},a))}; | ||
b.s=function(a){this.a.setOptions(h({},a))}; | ||
b.A=function(a){var c=new google.maps.LatLng(a.coords.latitude,a.coords.longitude),e=null==this.b.getMap();if(e){if(null!=this.h()&&a.coords.accuracy>this.h())return;this.b.setMap(this.i());this.b.bindTo("position",this);this.a.bindTo("center",this,"position");this.a.bindTo("radius",this,"accuracy")}this.j()!=a.coords.accuracy&&google.maps.MVCObject.prototype.set.call(this,"accuracy",a.coords.accuracy);!e&&null!=this.c()&&this.c().equals(c)||google.maps.MVCObject.prototype.set.call(this,"position", | ||
c)};b.o=function(a){google.maps.event.trigger(this,"geolocation_error",a)};function h(a,c){for(var e in c)!0!==l[e]&&(a[e]=c[e]);return a}var l={map:!0,position:!0,radius:!0},k=/^(?:position|accuracy)$/i;function m(){g.prototype.getAccuracy=g.prototype.j;g.prototype.getBounds=g.prototype.m;g.prototype.getMap=g.prototype.i;g.prototype.getMinimumAccuracy=g.prototype.h;g.prototype.getPosition=g.prototype.c;g.prototype.getPositionOptions=g.prototype.l;g.prototype.setCircleOptions=g.prototype.s;g.prototype.setMap=g.prototype.f;g.prototype.setMarkerOptions=g.prototype.u;g.prototype.setMinimumAccuracy=g.prototype.v;g.prototype.setPositionOptions=g.prototype.w;return g} | ||
"function"===typeof this.define&&this.define.amd?this.define([],m):"object"===typeof this.exports?this.module.exports=m():this.GeolocationMarker=m();}).call(this) | ||
'use strict';var b;function e(a,c){function f(){}f.prototype=c.prototype;a.B=c.prototype;a.prototype=new f;a.prototype.constructor=a;for(var g in c)if("prototype"!=g)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(c,g);d&&Object.defineProperty(a,g,d)}else a[g]=c[g]} | ||
function h(a,c,f,g){var d=google.maps.MVCObject.call(this)||this;d.c=null;d.b=null;d.a=null;d.i=-1;var l={clickable:!1,cursor:"pointer",draggable:!1,flat:!0,icon:{path:google.maps.SymbolPath.CIRCLE,fillColor:"#C8D6EC",fillOpacity:.7,scale:12,strokeWeight:0},position:new google.maps.LatLng(0,0),title:"Current location",zIndex:2},m={clickable:!1,cursor:"pointer",draggable:!1,flat:!0,icon:{path:google.maps.SymbolPath.CIRCLE,fillColor:"#4285F4",fillOpacity:1,scale:6,strokeColor:"white",strokeWeight:2}, | ||
optimized:!1,position:new google.maps.LatLng(0,0),title:"Current location",zIndex:3};c&&(l=k(l,c));f&&(m=k(m,f));c={clickable:!1,radius:0,strokeColor:"1bb6ff",strokeOpacity:.4,fillColor:"61a0bf",fillOpacity:.4,strokeWeight:1,zIndex:1};g&&(c=k(c,g));d.c=new google.maps.Marker(l);d.b=new google.maps.Marker(m);d.a=new google.maps.Circle(c);google.maps.MVCObject.prototype.set.call(d,"accuracy",null);google.maps.MVCObject.prototype.set.call(d,"position",null);google.maps.MVCObject.prototype.set.call(d, | ||
"map",null);d.set("minimum_accuracy",null);d.set("position_options",{enableHighAccuracy:!0,maximumAge:1E3});d.a.bindTo("map",d.c);d.a.bindTo("map",d.b);a&&d.setMap(a);return d}e(h,google.maps.MVCObject);b=h.prototype;b.set=function(a,c){if(n.test(a))throw"'"+a+"' is a read-only property.";"map"===a?this.setMap(c):google.maps.MVCObject.prototype.set.call(this,a,c)};b.f=function(){return this.get("map")};b.l=function(){return this.get("position_options")}; | ||
b.w=function(a){this.set("position_options",a)};b.g=function(){return this.get("position")};b.m=function(){return this.get("position")?this.a.getBounds():null};b.j=function(){return this.get("accuracy")};b.h=function(){return this.get("minimum_accuracy")};b.v=function(a){this.set("minimum_accuracy",a)}; | ||
b.setMap=function(a){google.maps.MVCObject.prototype.set.call(this,"map",a);a?navigator.geolocation&&(this.i=navigator.geolocation.watchPosition(this.A.bind(this),this.o.bind(this),this.l())):(this.c.unbind("position"),this.b.unbind("position"),this.a.unbind("center"),this.a.unbind("radius"),google.maps.MVCObject.prototype.set.call(this,"accuracy",null),google.maps.MVCObject.prototype.set.call(this,"position",null),navigator.geolocation.clearWatch(this.i),this.i=-1,this.c.setMap(a),this.b.setMap(a))}; | ||
b.u=function(a){this.b.setOptions(k({},a))};b.s=function(a){this.a.setOptions(k({},a))}; | ||
b.A=function(a){var c=new google.maps.LatLng(a.coords.latitude,a.coords.longitude),f=!this.b.getMap();if(f){if(null!=this.h()&&a.coords.accuracy>this.h())return;this.c.setMap(this.f());this.b.setMap(this.f());this.c.bindTo("position",this);this.b.bindTo("position",this);this.a.bindTo("center",this,"position");this.a.bindTo("radius",this,"accuracy")}this.j()!=a.coords.accuracy&&google.maps.MVCObject.prototype.set.call(this,"accuracy",a.coords.accuracy);!f&&this.g()&&this.g().equals(c)||google.maps.MVCObject.prototype.set.call(this, | ||
"position",c)};b.o=function(a){google.maps.event.trigger(this,"geolocation_error",a)};function k(a,c){for(var f in c)!0!==p[f]&&(a[f]=c[f]);return a}var p={map:!0,position:!0,radius:!0},n=/^(?:position|accuracy)$/i;var q=window;function r(){h.prototype.getAccuracy=h.prototype.j;h.prototype.getBounds=h.prototype.m;h.prototype.getMap=h.prototype.f;h.prototype.getMinimumAccuracy=h.prototype.h;h.prototype.getPosition=h.prototype.g;h.prototype.getPositionOptions=h.prototype.l;h.prototype.setCircleOptions=h.prototype.s;h.prototype.setMap=h.prototype.setMap;h.prototype.setMarkerOptions=h.prototype.u;h.prototype.setMinimumAccuracy=h.prototype.v;h.prototype.setPositionOptions=h.prototype.w;return h} | ||
"function"===typeof q.define&&q.define.amd?q.define([],r):"object"===typeof q.exports?q.module.exports=r():q.GeolocationMarker=r(); | ||
}).call(this) | ||
//# sourceMappingURL=geolocation-marker.js.map |
@@ -5,3 +5,3 @@ { | ||
"author": "Chad Killingsworth <chadkillingsworth@gmail.com", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"keywords": [ | ||
@@ -33,8 +33,8 @@ "Google Maps", | ||
"devDependencies": { | ||
"google-closure-compiler": "^20151015.0.0", | ||
"google-closure-compiler": ">=20170626.0.0", | ||
"gulp": "^3.9.0", | ||
"gulp-closure-compiler": "^0.3.1", | ||
"gulp-connect": "^2.2.0", | ||
"gulp-replace": "^0.5.4" | ||
"gulp-replace": "^0.5.4", | ||
"gulp-sourcemaps": "^1.6.0" | ||
} | ||
} |
@@ -8,5 +8,5 @@ # Geolocation Marker for Google Maps API v3 | ||
### Direct download | ||
Download the [latest release files](https://github.com/ChadKillingsworth/geolocation-marker/releases/tag/v2.0.4) directly. | ||
Download the [latest release files](https://github.com/ChadKillingsworth/geolocation-marker/releases/tag/v2.0.5) directly. | ||
For most users, all you really need is the [geolocation-marker.js](https://github.com/ChadKillingsworth/geolocation-marker/releases/download/v2.0.4/geolocation-marker.js) file. | ||
For most users, all you really need is the [geolocation-marker.js](https://github.com/ChadKillingsworth/geolocation-marker/releases/download/v2.0.5/geolocation-marker.js) file. | ||
This is the prebuilt source that works in all supported browsers. | ||
@@ -22,3 +22,3 @@ | ||
bower install https://github.com/ChadKillingsworth/geolocation-marker/releases/download/v2.0.4/geolocation-marker.tgz | ||
bower install https://github.com/ChadKillingsworth/geolocation-marker/releases/download/v2.0.5/geolocation-marker.tgz | ||
@@ -25,0 +25,0 @@ ## Example Usage |
@@ -26,3 +26,3 @@ /* | ||
import GeolocationMarker from './geolocation-marker'; | ||
import GeolocationMarker from './geolocation-marker.js'; | ||
@@ -37,3 +37,3 @@ ;(function(root, factory) { | ||
} | ||
}(this, function() { | ||
}(window, function() { | ||
GeolocationMarker.prototype['getAccuracy'] = GeolocationMarker.prototype.getAccuracy; | ||
@@ -40,0 +40,0 @@ GeolocationMarker.prototype['getBounds'] = GeolocationMarker.prototype.getBounds; |
@@ -22,6 +22,7 @@ /** | ||
* @param {google.maps.Map=} opt_map | ||
* @param {(google.maps.MarkerOptions|Object.<string>)=} opt_outerMarkerOpts | ||
* @param {(google.maps.MarkerOptions|Object.<string>)=} opt_markerOpts | ||
* @param {(google.maps.CircleOptions|Object.<string>)=} opt_circleOpts | ||
*/ | ||
constructor(opt_map, opt_markerOpts, opt_circleOpts) { | ||
constructor(opt_map, opt_outerMarkerOpts, opt_markerOpts, opt_circleOpts) { | ||
super(); | ||
@@ -33,2 +34,8 @@ | ||
*/ | ||
this.outerMarker_ = null; | ||
/** | ||
* @private | ||
* @type {google.maps.Marker} | ||
*/ | ||
this.marker_ = null; | ||
@@ -48,2 +55,19 @@ | ||
var outerMarkerOpts = { | ||
'clickable': false, | ||
'cursor': 'pointer', | ||
'draggable': false, | ||
'flat': true, | ||
'icon': { | ||
'path': google.maps.SymbolPath.CIRCLE, | ||
'fillColor': '#C8D6EC', | ||
'fillOpacity': 0.7, | ||
'scale': 12, | ||
'strokeWeight': 0, | ||
}, | ||
'position': new google.maps.LatLng(0, 0), | ||
'title': 'Current location', | ||
'zIndex': 2 | ||
}; | ||
var markerOpts = { | ||
@@ -55,7 +79,8 @@ 'clickable': false, | ||
'icon': { | ||
'url': 'https://chadkillingsworth.github.io/geolocation-marker/images/gpsloc.png', | ||
'size': new google.maps.Size(34, 34), | ||
'scaledSize': new google.maps.Size(17, 17), | ||
'origin': new google.maps.Point(0, 0), | ||
'anchor': new google.maps.Point(8, 8) | ||
'path': google.maps.SymbolPath.CIRCLE, | ||
'fillColor': '#4285F4', | ||
'fillOpacity': 1, | ||
'scale': 6, | ||
'strokeColor': 'white', | ||
'strokeWeight': 2, | ||
}, | ||
@@ -66,5 +91,9 @@ // This marker may move frequently - don't force canvas tile redraw | ||
'title': 'Current location', | ||
'zIndex': 2 | ||
'zIndex': 3 | ||
}; | ||
if(opt_outerMarkerOpts) { | ||
outerMarkerOpts = this.copyOptions_(outerMarkerOpts, opt_outerMarkerOpts); | ||
} | ||
if(opt_markerOpts) { | ||
@@ -89,2 +118,3 @@ markerOpts = this.copyOptions_(markerOpts, opt_markerOpts); | ||
this.outerMarker_ = new google.maps.Marker(outerMarkerOpts); | ||
this.marker_ = new google.maps.Marker(markerOpts); | ||
@@ -102,2 +132,3 @@ this.circle_ = new google.maps.Circle(circleOpts); | ||
this.circle_.bindTo('map', this.outerMarker_); | ||
this.circle_.bindTo('map', this.marker_); | ||
@@ -175,2 +206,3 @@ | ||
} else { | ||
this.outerMarker_.unbind('position'); | ||
this.marker_.unbind('position'); | ||
@@ -183,2 +215,3 @@ this.circle_.unbind('center'); | ||
this.watchId_ = -1; | ||
this.outerMarker_.setMap(map); | ||
this.marker_.setMap(map); | ||
@@ -188,2 +221,7 @@ } | ||
/** @param {google.maps.MarkerOptions|Object.<string>} outerMarkerOpts */ | ||
setOuterMarkerOptions(outerMarkerOpts) { | ||
this.outerMarker_.setOptions(this.copyOptions_({}, outerMarkerOpts)); | ||
} | ||
/** @param {google.maps.MarkerOptions|Object.<string>} markerOpts */ | ||
@@ -212,3 +250,5 @@ setMarkerOptions(markerOpts) { | ||
} | ||
this.outerMarker_.setMap(this.getMap()); | ||
this.marker_.setMap(this.getMap()); | ||
this.outerMarker_.bindTo('position', this); | ||
this.marker_.bindTo('position', this); | ||
@@ -215,0 +255,0 @@ this.circle_.bindTo('center', this, 'position'); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40269
363