Replace getChangeEventType() with add/removeChangeListener methods
This commit is contained in:
@@ -9,7 +9,6 @@ import ObjectEventType from '../ObjectEventType.js';
|
||||
import SourceState from '../source/State.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import {assign, clear} from '../obj.js';
|
||||
import {getChangeEventType} from '../Object.js';
|
||||
import {getIntersection} from '../extent.js';
|
||||
import {getUid} from '../util.js';
|
||||
import {listen, unlistenByKey} from '../events.js';
|
||||
@@ -77,10 +76,7 @@ class LayerGroup extends BaseLayer {
|
||||
*/
|
||||
this.listenerKeys_ = {};
|
||||
|
||||
this.addEventListener(
|
||||
getChangeEventType(Property.LAYERS),
|
||||
this.handleLayersChanged_
|
||||
);
|
||||
this.addChangeListener(Property.LAYERS, this.handleLayersChanged_);
|
||||
|
||||
if (layers) {
|
||||
if (Array.isArray(layers)) {
|
||||
|
||||
@@ -6,7 +6,6 @@ import WebGLPointsLayerRenderer from '../renderer/webgl/PointsLayer.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {clamp} from '../math.js';
|
||||
import {createCanvasContext2D} from '../dom.js';
|
||||
import {getChangeEventType} from '../Object.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
@@ -86,10 +85,7 @@ class Heatmap extends VectorLayer {
|
||||
*/
|
||||
this.gradient_ = null;
|
||||
|
||||
this.addEventListener(
|
||||
getChangeEventType(Property.GRADIENT),
|
||||
this.handleGradientChanged_
|
||||
);
|
||||
this.addChangeListener(Property.GRADIENT, this.handleGradientChanged_);
|
||||
|
||||
this.setGradient(options.gradient ? options.gradient : DEFAULT_GRADIENT);
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import RenderEventType from '../render/EventType.js';
|
||||
import SourceState from '../source/State.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {getChangeEventType} from '../Object.js';
|
||||
import {listen, unlistenByKey} from '../events.js';
|
||||
|
||||
/**
|
||||
@@ -130,8 +129,8 @@ class Layer extends BaseLayer {
|
||||
this.setMap(options.map);
|
||||
}
|
||||
|
||||
this.addEventListener(
|
||||
getChangeEventType(LayerProperty.SOURCE),
|
||||
this.addChangeListener(
|
||||
LayerProperty.SOURCE,
|
||||
this.handleSourcePropertyChange_
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user