Simplify events and store listeners only in one place

This commit is contained in:
ahocevar
2019-09-04 16:39:32 +02:00
parent d416866108
commit ebfb20440a
52 changed files with 224 additions and 599 deletions

View File

@@ -3,7 +3,6 @@
*/
import ImageWrapper from '../Image.js';
import {listen} from '../events.js';
import EventType from '../events/EventType.js';
import {containsExtent, getCenter, getHeight, getWidth, scaleFromCenter} from '../extent.js';
import {assign} from '../obj.js';
@@ -162,8 +161,7 @@ class ImageMapGuide extends ImageSource {
image = new ImageWrapper(extent, resolution, pixelRatio,
imageUrl, this.crossOrigin_,
this.imageLoadFunction_);
listen(image, EventType.CHANGE,
this.handleImageChange, this);
image.addEventListener(EventType.CHANGE, this.handleImageChange.bind(this));
} else {
image = null;
}