Use listen function instead of on
In #7614, the `opt_this` argument was removed from `Observable#on`, `#once` and `#un` but internal code was not adapted.
This commit is contained in:
+10
-3
@@ -2,6 +2,7 @@
|
|||||||
* @module ol/Graticule
|
* @module ol/Graticule
|
||||||
*/
|
*/
|
||||||
import {degreesToStringHDMS} from './coordinate.js';
|
import {degreesToStringHDMS} from './coordinate.js';
|
||||||
|
import {listen, unlistenByKey} from './events.js';
|
||||||
import {intersects, getCenter} from './extent.js';
|
import {intersects, getCenter} from './extent.js';
|
||||||
import GeometryLayout from './geom/GeometryLayout.js';
|
import GeometryLayout from './geom/GeometryLayout.js';
|
||||||
import LineString from './geom/LineString.js';
|
import LineString from './geom/LineString.js';
|
||||||
@@ -129,9 +130,14 @@ const Graticule = function(opt_options) {
|
|||||||
this.map_ = null;
|
this.map_ = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ol.proj.Projection}
|
* @type {?ol.EventsKey}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
|
this.postcomposeListenerKey_ = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {ol.proj.Projection}
|
||||||
|
*/
|
||||||
this.projection_ = null;
|
this.projection_ = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -721,11 +727,12 @@ Graticule.prototype.updateProjectionInfo_ = function(projection) {
|
|||||||
*/
|
*/
|
||||||
Graticule.prototype.setMap = function(map) {
|
Graticule.prototype.setMap = function(map) {
|
||||||
if (this.map_) {
|
if (this.map_) {
|
||||||
this.map_.un(RenderEventType.POSTCOMPOSE, this.handlePostCompose_, this);
|
unlistenByKey(this.postcomposeListenerKey_);
|
||||||
|
this.postcomposeListenerKey_ = null;
|
||||||
this.map_.render();
|
this.map_.render();
|
||||||
}
|
}
|
||||||
if (map) {
|
if (map) {
|
||||||
map.on(RenderEventType.POSTCOMPOSE, this.handlePostCompose_, this);
|
this.postcomposeListenerKey_ = listen(map, RenderEventType.POSTCOMPOSE, this.handlePostCompose_, this);
|
||||||
map.render();
|
map.render();
|
||||||
}
|
}
|
||||||
this.map_ = map;
|
this.map_ = map;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {getUid, inherits} from '../index.js';
|
|||||||
import {assert} from '../asserts.js';
|
import {assert} from '../asserts.js';
|
||||||
import Feature from '../Feature.js';
|
import Feature from '../Feature.js';
|
||||||
import {scale as scaleCoordinate, add as addCoordinate} from '../coordinate.js';
|
import {scale as scaleCoordinate, add as addCoordinate} from '../coordinate.js';
|
||||||
|
import {listen} from '../events.js';
|
||||||
import EventType from '../events/EventType.js';
|
import EventType from '../events/EventType.js';
|
||||||
import {buffer, createEmpty, createOrUpdateFromCoordinate} from '../extent.js';
|
import {buffer, createEmpty, createOrUpdateFromCoordinate} from '../extent.js';
|
||||||
import Point from '../geom/Point.js';
|
import Point from '../geom/Point.js';
|
||||||
@@ -66,8 +67,7 @@ const Cluster = function(options) {
|
|||||||
*/
|
*/
|
||||||
this.source = options.source;
|
this.source = options.source;
|
||||||
|
|
||||||
this.source.on(EventType.CHANGE,
|
listen(this.source, EventType.CHANGE, this.refresh, this);
|
||||||
Cluster.prototype.refresh, this);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inherits(Cluster, VectorSource);
|
inherits(Cluster, VectorSource);
|
||||||
|
|||||||
Reference in New Issue
Block a user