@@ -29,7 +29,7 @@ var geolocation = new ol.Geolocation({
|
|||||||
tracking: true
|
tracking: true
|
||||||
});
|
});
|
||||||
geolocation.bindTo('projection', view);
|
geolocation.bindTo('projection', view);
|
||||||
geolocation.on('position_changed', function() {
|
geolocation.onOnce('position_changed', function() {
|
||||||
view.setCenter(geolocation.getPosition());
|
view.setCenter(geolocation.getPosition());
|
||||||
view.setResolution(2.388657133911758);
|
view.setResolution(2.388657133911758);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,9 +3,11 @@
|
|||||||
@exportProperty ol.Object.prototype.get
|
@exportProperty ol.Object.prototype.get
|
||||||
@exportProperty ol.Object.prototype.notify
|
@exportProperty ol.Object.prototype.notify
|
||||||
@exportProperty ol.Object.prototype.on
|
@exportProperty ol.Object.prototype.on
|
||||||
|
@exportProperty ol.Object.prototype.onOnce
|
||||||
@exportProperty ol.Object.prototype.set
|
@exportProperty ol.Object.prototype.set
|
||||||
@exportProperty ol.Object.prototype.setOptions
|
@exportProperty ol.Object.prototype.setOptions
|
||||||
@exportProperty ol.Object.prototype.setValues
|
@exportProperty ol.Object.prototype.setValues
|
||||||
@exportProperty ol.Object.prototype.un
|
@exportProperty ol.Object.prototype.un
|
||||||
|
@exportProperty ol.Object.prototype.unByKey
|
||||||
@exportProperty ol.Object.prototype.unbind
|
@exportProperty ol.Object.prototype.unbind
|
||||||
@exportProperty ol.Object.prototype.unbindAll
|
@exportProperty ol.Object.prototype.unbindAll
|
||||||
|
|||||||
+22
-1
@@ -228,9 +228,22 @@ ol.Object.prototype.notifyInternal_ = function(key) {
|
|||||||
* @param {Function} listener The listener function.
|
* @param {Function} listener The listener function.
|
||||||
* @param {Object=} opt_scope Object is whose scope to call
|
* @param {Object=} opt_scope Object is whose scope to call
|
||||||
* the listener.
|
* the listener.
|
||||||
|
* @return {?number} Unique key for the listener.
|
||||||
*/
|
*/
|
||||||
ol.Object.prototype.on = function(type, listener, opt_scope) {
|
ol.Object.prototype.on = function(type, listener, opt_scope) {
|
||||||
goog.events.listen(this, type, listener, false, opt_scope);
|
return goog.events.listen(this, type, listener, false, opt_scope);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} type The event type.
|
||||||
|
* @param {Function} listener The listener function.
|
||||||
|
* @param {Object=} opt_scope Object is whose scope to call
|
||||||
|
* the listener.
|
||||||
|
* @return {?number} Unique key for the listener.
|
||||||
|
*/
|
||||||
|
ol.Object.prototype.onOnce = function(type, listener, opt_scope) {
|
||||||
|
return goog.events.listenOnce(this, type, listener, false, opt_scope);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -308,6 +321,14 @@ ol.Object.prototype.un = function(type, listener, opt_scope) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {?number} key Key.
|
||||||
|
*/
|
||||||
|
ol.Object.prototype.unByKey = function(key) {
|
||||||
|
goog.events.unlistenByKey(key);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all bindings.
|
* Removes all bindings.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user