Named exports from ol/events
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Image_ from '../Image.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import {listen} from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {containsExtent, getHeight, getWidth} from '../extent.js';
|
||||
import {assign} from '../obj.js';
|
||||
@@ -173,7 +173,7 @@ ImageArcGISRest.prototype.getImageInternal = function(extent, resolution, pixelR
|
||||
|
||||
this.renderedRevision_ = this.getRevision();
|
||||
|
||||
_ol_events_.listen(this.image_, EventType.CHANGE,
|
||||
listen(this.image_, EventType.CHANGE,
|
||||
this.handleImageChange, this);
|
||||
|
||||
return this.image_;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Image_ from '../Image.js';
|
||||
import _ol_events_ from '../events.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';
|
||||
@@ -144,7 +144,7 @@ ImageMapGuide.prototype.getImageInternal = function(extent, resolution, pixelRat
|
||||
image = new _ol_Image_(extent, resolution, pixelRatio,
|
||||
imageUrl, this.crossOrigin_,
|
||||
this.imageLoadFunction_);
|
||||
_ol_events_.listen(image, EventType.CHANGE,
|
||||
listen(image, EventType.CHANGE,
|
||||
this.handleImageChange, this);
|
||||
} else {
|
||||
image = null;
|
||||
|
||||
@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
|
||||
import _ol_Image_ from '../Image.js';
|
||||
import ImageState from '../ImageState.js';
|
||||
import {createCanvasContext2D} from '../dom.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import {listen} from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {intersects, getHeight, getWidth} from '../extent.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
@@ -47,7 +47,7 @@ const Static = function(options) {
|
||||
*/
|
||||
this.imageSize_ = options.imageSize ? options.imageSize : null;
|
||||
|
||||
_ol_events_.listen(this.image_, EventType.CHANGE,
|
||||
listen(this.image_, EventType.CHANGE,
|
||||
this.handleImageChange, this);
|
||||
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ import {DEFAULT_WMS_VERSION} from './common.js';
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Image_ from '../Image.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import {listen} from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {containsExtent, getCenter, getForViewAndSize, getHeight, getWidth} from '../extent.js';
|
||||
import {assign} from '../obj.js';
|
||||
@@ -236,7 +236,7 @@ ImageWMS.prototype.getImageInternal = function(extent, resolution, pixelRatio, p
|
||||
|
||||
this.renderedRevision_ = this.getRevision();
|
||||
|
||||
_ol_events_.listen(this.image_, EventType.CHANGE,
|
||||
listen(this.image_, EventType.CHANGE,
|
||||
this.handleImageChange, this);
|
||||
|
||||
return this.image_;
|
||||
|
||||
@@ -5,7 +5,7 @@ import {getUid, inherits} from '../index.js';
|
||||
import ImageCanvas from '../ImageCanvas.js';
|
||||
import TileQueue from '../TileQueue.js';
|
||||
import {createCanvasContext2D} from '../dom.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import {listen} from '../events.js';
|
||||
import Event from '../events/Event.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {Processor} from 'pixelworks';
|
||||
@@ -82,7 +82,7 @@ const RasterSource = function(options) {
|
||||
this.renderers_ = createRenderers(options.sources);
|
||||
|
||||
for (let r = 0, rr = this.renderers_.length; r < rr; ++r) {
|
||||
_ol_events_.listen(this.renderers_[r], EventType.CHANGE,
|
||||
listen(this.renderers_[r], EventType.CHANGE,
|
||||
this.changed, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import {getUid, inherits} from '../index.js';
|
||||
import ImageTile from '../ImageTile.js';
|
||||
import TileCache from '../TileCache.js';
|
||||
import TileState from '../TileState.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import {listen} from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {equivalent, get as getProjection} from '../proj.js';
|
||||
import ReprojTile from '../reproj/Tile.js';
|
||||
@@ -224,7 +224,7 @@ TileImage.prototype.createTile_ = function(z, x, y, pixelRatio, projection, key)
|
||||
this.tileLoadFunction,
|
||||
this.tileOptions);
|
||||
tile.key = key;
|
||||
_ol_events_.listen(tile, EventType.CHANGE,
|
||||
listen(tile, EventType.CHANGE,
|
||||
this.handleTileChange, this);
|
||||
return tile;
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ import Tile from '../Tile.js';
|
||||
import TileState from '../TileState.js';
|
||||
import {createFromTemplates, nullTileUrlFunction} from '../tileurlfunction.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import {listenOnce} from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {applyTransform, intersects} from '../extent.js';
|
||||
import _ol_net_ from '../net.js';
|
||||
@@ -371,7 +371,7 @@ UTFGrid.Tile_.prototype.getData = function(coordinate) {
|
||||
*/
|
||||
UTFGrid.Tile_.prototype.forDataAtCoordinate = function(coordinate, callback, opt_this, opt_request) {
|
||||
if (this.state == TileState.IDLE && opt_request === true) {
|
||||
_ol_events_.listenOnce(this, EventType.CHANGE, function(e) {
|
||||
listenOnce(this, EventType.CHANGE, function(e) {
|
||||
callback.call(opt_this, this.getData(coordinate));
|
||||
}, this);
|
||||
this.loadInternal_();
|
||||
|
||||
@@ -8,7 +8,7 @@ import CollectionEventType from '../CollectionEventType.js';
|
||||
import ObjectEventType from '../ObjectEventType.js';
|
||||
import {extend} from '../array.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import {listen, unlistenByKey} from '../events.js';
|
||||
import Event from '../events/Event.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {containsExtent, equals} from '../extent.js';
|
||||
@@ -203,9 +203,9 @@ VectorSource.prototype.addFeatureInternal = function(feature) {
|
||||
*/
|
||||
VectorSource.prototype.setupChangeEvents_ = function(featureKey, feature) {
|
||||
this.featureChangeKeys_[featureKey] = [
|
||||
_ol_events_.listen(feature, EventType.CHANGE,
|
||||
listen(feature, EventType.CHANGE,
|
||||
this.handleFeatureChange_, this),
|
||||
_ol_events_.listen(feature, ObjectEventType.PROPERTYCHANGE,
|
||||
listen(feature, ObjectEventType.PROPERTYCHANGE,
|
||||
this.handleFeatureChange_, this)
|
||||
];
|
||||
};
|
||||
@@ -295,7 +295,7 @@ VectorSource.prototype.addFeaturesInternal = function(features) {
|
||||
*/
|
||||
VectorSource.prototype.bindFeaturesCollection_ = function(collection) {
|
||||
let modifyingCollection = false;
|
||||
_ol_events_.listen(this, VectorEventType.ADDFEATURE,
|
||||
listen(this, VectorEventType.ADDFEATURE,
|
||||
function(evt) {
|
||||
if (!modifyingCollection) {
|
||||
modifyingCollection = true;
|
||||
@@ -303,7 +303,7 @@ VectorSource.prototype.bindFeaturesCollection_ = function(collection) {
|
||||
modifyingCollection = false;
|
||||
}
|
||||
});
|
||||
_ol_events_.listen(this, VectorEventType.REMOVEFEATURE,
|
||||
listen(this, VectorEventType.REMOVEFEATURE,
|
||||
function(evt) {
|
||||
if (!modifyingCollection) {
|
||||
modifyingCollection = true;
|
||||
@@ -311,7 +311,7 @@ VectorSource.prototype.bindFeaturesCollection_ = function(collection) {
|
||||
modifyingCollection = false;
|
||||
}
|
||||
});
|
||||
_ol_events_.listen(collection, CollectionEventType.ADD,
|
||||
listen(collection, CollectionEventType.ADD,
|
||||
function(evt) {
|
||||
if (!modifyingCollection) {
|
||||
modifyingCollection = true;
|
||||
@@ -319,7 +319,7 @@ VectorSource.prototype.bindFeaturesCollection_ = function(collection) {
|
||||
modifyingCollection = false;
|
||||
}
|
||||
}, this);
|
||||
_ol_events_.listen(collection, CollectionEventType.REMOVE,
|
||||
listen(collection, CollectionEventType.REMOVE,
|
||||
function(evt) {
|
||||
if (!modifyingCollection) {
|
||||
modifyingCollection = true;
|
||||
@@ -340,7 +340,7 @@ VectorSource.prototype.clear = function(opt_fast) {
|
||||
if (opt_fast) {
|
||||
for (const featureId in this.featureChangeKeys_) {
|
||||
const keys = this.featureChangeKeys_[featureId];
|
||||
keys.forEach(_ol_events_.unlistenByKey);
|
||||
keys.forEach(unlistenByKey);
|
||||
}
|
||||
if (!this.featuresCollection_) {
|
||||
this.featureChangeKeys_ = {};
|
||||
@@ -798,7 +798,7 @@ VectorSource.prototype.removeFeature = function(feature) {
|
||||
*/
|
||||
VectorSource.prototype.removeFeatureInternal = function(feature) {
|
||||
const featureKey = getUid(feature).toString();
|
||||
this.featureChangeKeys_[featureKey].forEach(_ol_events_.unlistenByKey);
|
||||
this.featureChangeKeys_[featureKey].forEach(unlistenByKey);
|
||||
delete this.featureChangeKeys_[featureKey];
|
||||
const id = feature.getId();
|
||||
if (id !== undefined) {
|
||||
|
||||
Reference in New Issue
Block a user