Replace getChangeEventType() with add/removeChangeListener methods

This commit is contained in:
Andreas Hocevar
2021-06-19 14:22:23 +02:00
parent cf7213c5cb
commit 343e0ffce9
13 changed files with 49 additions and 110 deletions

View File

@@ -4,7 +4,6 @@
import Control from './Control.js';
import EventType from '../pointer/EventType.js';
import {getChangeEventType} from '../Object.js';
import {
get as getProjection,
getTransformFromProjections,
@@ -69,10 +68,7 @@ class MousePosition extends Control {
target: options.target,
});
this.addEventListener(
getChangeEventType(PROJECTION),
this.handleProjectionChanged_
);
this.addChangeListener(PROJECTION, this.handleProjectionChanged_);
if (options.coordinateFormat) {
this.setCoordinateFormat(options.coordinateFormat);

View File

@@ -20,7 +20,6 @@ import {
getTopLeft,
scaleFromCenter,
} from '../extent.js';
import {getChangeEventType} from '../Object.js';
import {listen, listenOnce} from '../events.js';
import {fromExtent as polygonFromExtent} from '../geom/Polygon.js';
import {replaceNode} from '../dom.js';
@@ -348,8 +347,8 @@ class OverviewMap extends Control {
this.ovmap_.setView(newView);
}
view.addEventListener(
getChangeEventType(ViewProperty.ROTATION),
view.addChangeListener(
ViewProperty.ROTATION,
this.boundHandleRotationChanged_
);
// Sync once with the new view
@@ -362,8 +361,8 @@ class OverviewMap extends Control {
* @private
*/
unbindView_(view) {
view.removeEventListener(
getChangeEventType(ViewProperty.ROTATION),
view.removeChangeListener(
ViewProperty.ROTATION,
this.boundHandleRotationChanged_
);
}

View File

@@ -6,7 +6,6 @@ import ProjUnits from '../proj/Units.js';
import {CLASS_UNSELECTABLE} from '../css.js';
import {METERS_PER_UNIT, getPointResolution} from '../proj.js';
import {assert} from '../asserts.js';
import {getChangeEventType} from '../Object.js';
/**
* @type {string}
@@ -131,10 +130,7 @@ class ScaleLine extends Control {
*/
this.renderedHTML_ = '';
this.addEventListener(
getChangeEventType(UNITS_PROP),
this.handleUnitsChanged_
);
this.addChangeListener(UNITS_PROP, this.handleUnitsChanged_);
this.setUnits(options.units || Units.METRIC);