Merge pull request #2684 from ahocevar/notify-change
Rename ol.Observable#dispatchChangeEvent() to #changed()
This commit is contained in:
@@ -220,7 +220,7 @@ function simulatePositionChange(position) {
|
|||||||
'EPSG:3857');
|
'EPSG:3857');
|
||||||
geolocation.set('position', projectedPosition);
|
geolocation.set('position', projectedPosition);
|
||||||
geolocation.set('speed', coords.speed);
|
geolocation.set('speed', coords.speed);
|
||||||
geolocation.dispatchChangeEvent();
|
geolocation.changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
function disableButtons() {
|
function disableButtons() {
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ ol.DeviceOrientation.prototype.orientationChange_ = function(browserEvent) {
|
|||||||
this.set(ol.DeviceOrientationProperty.GAMMA,
|
this.set(ol.DeviceOrientationProperty.GAMMA,
|
||||||
goog.math.toRadians(event.gamma));
|
goog.math.toRadians(event.gamma));
|
||||||
}
|
}
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -198,7 +198,7 @@ ol.Feature.prototype.getStyleFunction = function() {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.Feature.prototype.handleGeometryChange_ = function() {
|
ol.Feature.prototype.handleGeometryChange_ = function() {
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -214,7 +214,7 @@ ol.Feature.prototype.handleGeometryChanged_ = function() {
|
|||||||
if (goog.isDefAndNotNull(geometry)) {
|
if (goog.isDefAndNotNull(geometry)) {
|
||||||
this.geometryChangeKey_ = goog.events.listen(geometry,
|
this.geometryChangeKey_ = goog.events.listen(geometry,
|
||||||
goog.events.EventType.CHANGE, this.handleGeometryChange_, false, this);
|
goog.events.EventType.CHANGE, this.handleGeometryChange_, false, this);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -244,7 +244,7 @@ goog.exportProperty(
|
|||||||
ol.Feature.prototype.setStyle = function(style) {
|
ol.Feature.prototype.setStyle = function(style) {
|
||||||
this.style_ = style;
|
this.style_ = style;
|
||||||
this.styleFunction_ = ol.feature.createFeatureStyleFunction(style);
|
this.styleFunction_ = ol.feature.createFeatureStyleFunction(style);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ ol.Feature.prototype.setStyle = function(style) {
|
|||||||
*/
|
*/
|
||||||
ol.Feature.prototype.setId = function(id) {
|
ol.Feature.prototype.setId = function(id) {
|
||||||
this.id_ = id;
|
this.id_ = id;
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ ol.Geolocation.prototype.positionChange_ = function(position) {
|
|||||||
ol.sphere.WGS84, this.position_, coords.accuracy);
|
ol.sphere.WGS84, this.position_, coords.accuracy);
|
||||||
geometry.applyTransform(this.transform_);
|
geometry.applyTransform(this.transform_);
|
||||||
this.set(ol.GeolocationProperty.ACCURACY_GEOMETRY, geometry);
|
this.set(ol.GeolocationProperty.ACCURACY_GEOMETRY, geometry);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ ol.geom.Circle.prototype.setCenterAndRadius =
|
|||||||
flatCoordinates[offset++] = flatCoordinates[i];
|
flatCoordinates[offset++] = flatCoordinates[i];
|
||||||
}
|
}
|
||||||
flatCoordinates.length = offset;
|
flatCoordinates.length = offset;
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ ol.geom.Circle.prototype.setCenterAndRadius =
|
|||||||
ol.geom.Circle.prototype.setFlatCoordinates =
|
ol.geom.Circle.prototype.setFlatCoordinates =
|
||||||
function(layout, flatCoordinates) {
|
function(layout, flatCoordinates) {
|
||||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ ol.geom.Circle.prototype.setFlatCoordinates =
|
|||||||
ol.geom.Circle.prototype.setRadius = function(radius) {
|
ol.geom.Circle.prototype.setRadius = function(radius) {
|
||||||
goog.asserts.assert(!goog.isNull(this.flatCoordinates));
|
goog.asserts.assert(!goog.isNull(this.flatCoordinates));
|
||||||
this.flatCoordinates[this.stride] = this.flatCoordinates[0] + radius;
|
this.flatCoordinates[this.stride] = this.flatCoordinates[0] + radius;
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ ol.geom.GeometryCollection.prototype.unlistenGeometriesChange_ = function() {
|
|||||||
for (i = 0, ii = this.geometries_.length; i < ii; ++i) {
|
for (i = 0, ii = this.geometries_.length; i < ii; ++i) {
|
||||||
goog.events.unlisten(
|
goog.events.unlisten(
|
||||||
this.geometries_[i], goog.events.EventType.CHANGE,
|
this.geometries_[i], goog.events.EventType.CHANGE,
|
||||||
this.dispatchChangeEvent, false, this);
|
this.changed, false, this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ ol.geom.GeometryCollection.prototype.listenGeometriesChange_ = function() {
|
|||||||
for (i = 0, ii = this.geometries_.length; i < ii; ++i) {
|
for (i = 0, ii = this.geometries_.length; i < ii; ++i) {
|
||||||
goog.events.listen(
|
goog.events.listen(
|
||||||
this.geometries_[i], goog.events.EventType.CHANGE,
|
this.geometries_[i], goog.events.EventType.CHANGE,
|
||||||
this.dispatchChangeEvent, false, this);
|
this.changed, false, this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ ol.geom.GeometryCollection.prototype.setGeometriesArray = function(geometries) {
|
|||||||
this.unlistenGeometriesChange_();
|
this.unlistenGeometriesChange_();
|
||||||
this.geometries_ = geometries;
|
this.geometries_ = geometries;
|
||||||
this.listenGeometriesChange_();
|
this.listenGeometriesChange_();
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ ol.geom.GeometryCollection.prototype.applyTransform = function(transformFn) {
|
|||||||
for (i = 0, ii = geometries.length; i < ii; ++i) {
|
for (i = 0, ii = geometries.length; i < ii; ++i) {
|
||||||
geometries[i].applyTransform(transformFn);
|
geometries[i].applyTransform(transformFn);
|
||||||
}
|
}
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ ol.geom.LinearRing.prototype.setCoordinates =
|
|||||||
}
|
}
|
||||||
this.flatCoordinates.length = ol.geom.flat.deflate.coordinates(
|
this.flatCoordinates.length = ol.geom.flat.deflate.coordinates(
|
||||||
this.flatCoordinates, 0, coordinates, this.stride);
|
this.flatCoordinates, 0, coordinates, this.stride);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -150,5 +150,5 @@ ol.geom.LinearRing.prototype.setCoordinates =
|
|||||||
ol.geom.LinearRing.prototype.setFlatCoordinates =
|
ol.geom.LinearRing.prototype.setFlatCoordinates =
|
||||||
function(layout, flatCoordinates) {
|
function(layout, flatCoordinates) {
|
||||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ ol.geom.LineString.prototype.appendCoordinate = function(coordinate) {
|
|||||||
} else {
|
} else {
|
||||||
ol.array.safeExtend(this.flatCoordinates, coordinate);
|
ol.array.safeExtend(this.flatCoordinates, coordinate);
|
||||||
}
|
}
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -206,7 +206,7 @@ ol.geom.LineString.prototype.setCoordinates =
|
|||||||
}
|
}
|
||||||
this.flatCoordinates.length = ol.geom.flat.deflate.coordinates(
|
this.flatCoordinates.length = ol.geom.flat.deflate.coordinates(
|
||||||
this.flatCoordinates, 0, coordinates, this.stride);
|
this.flatCoordinates, 0, coordinates, this.stride);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -218,5 +218,5 @@ ol.geom.LineString.prototype.setCoordinates =
|
|||||||
ol.geom.LineString.prototype.setFlatCoordinates =
|
ol.geom.LineString.prototype.setFlatCoordinates =
|
||||||
function(layout, flatCoordinates) {
|
function(layout, flatCoordinates) {
|
||||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ ol.geom.MultiLineString.prototype.appendLineString = function(lineString) {
|
|||||||
this.flatCoordinates, lineString.getFlatCoordinates().slice());
|
this.flatCoordinates, lineString.getFlatCoordinates().slice());
|
||||||
}
|
}
|
||||||
this.ends_.push(this.flatCoordinates.length);
|
this.ends_.push(this.flatCoordinates.length);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -261,7 +261,7 @@ ol.geom.MultiLineString.prototype.setCoordinates =
|
|||||||
var ends = ol.geom.flat.deflate.coordinatess(
|
var ends = ol.geom.flat.deflate.coordinatess(
|
||||||
this.flatCoordinates, 0, coordinates, this.stride, this.ends_);
|
this.flatCoordinates, 0, coordinates, this.stride, this.ends_);
|
||||||
this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];
|
this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -282,7 +282,7 @@ ol.geom.MultiLineString.prototype.setFlatCoordinates =
|
|||||||
}
|
}
|
||||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||||
this.ends_ = ends;
|
this.ends_ = ends;
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ ol.geom.MultiPoint.prototype.appendPoint = function(point) {
|
|||||||
} else {
|
} else {
|
||||||
ol.array.safeExtend(this.flatCoordinates, point.getFlatCoordinates());
|
ol.array.safeExtend(this.flatCoordinates, point.getFlatCoordinates());
|
||||||
}
|
}
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ ol.geom.MultiPoint.prototype.setCoordinates =
|
|||||||
}
|
}
|
||||||
this.flatCoordinates.length = ol.geom.flat.deflate.coordinates(
|
this.flatCoordinates.length = ol.geom.flat.deflate.coordinates(
|
||||||
this.flatCoordinates, 0, coordinates, this.stride);
|
this.flatCoordinates, 0, coordinates, this.stride);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -170,5 +170,5 @@ ol.geom.MultiPoint.prototype.setCoordinates =
|
|||||||
ol.geom.MultiPoint.prototype.setFlatCoordinates =
|
ol.geom.MultiPoint.prototype.setFlatCoordinates =
|
||||||
function(layout, flatCoordinates) {
|
function(layout, flatCoordinates) {
|
||||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ ol.geom.MultiPolygon.prototype.appendPolygon = function(polygon) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.endss_.push(ends);
|
this.endss_.push(ends);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -338,7 +338,7 @@ ol.geom.MultiPolygon.prototype.setCoordinates =
|
|||||||
this.flatCoordinates.length = lastEnds.length === 0 ?
|
this.flatCoordinates.length = lastEnds.length === 0 ?
|
||||||
0 : lastEnds[lastEnds.length - 1];
|
0 : lastEnds[lastEnds.length - 1];
|
||||||
}
|
}
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -360,7 +360,7 @@ ol.geom.MultiPolygon.prototype.setFlatCoordinates =
|
|||||||
}
|
}
|
||||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||||
this.endss_ = endss;
|
this.endss_ = endss;
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ ol.geom.Point.prototype.setCoordinates = function(coordinates, opt_layout) {
|
|||||||
}
|
}
|
||||||
this.flatCoordinates.length = ol.geom.flat.deflate.coordinate(
|
this.flatCoordinates.length = ol.geom.flat.deflate.coordinate(
|
||||||
this.flatCoordinates, 0, coordinates, this.stride);
|
this.flatCoordinates, 0, coordinates, this.stride);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -119,5 +119,5 @@ ol.geom.Point.prototype.setCoordinates = function(coordinates, opt_layout) {
|
|||||||
*/
|
*/
|
||||||
ol.geom.Point.prototype.setFlatCoordinates = function(layout, flatCoordinates) {
|
ol.geom.Point.prototype.setFlatCoordinates = function(layout, flatCoordinates) {
|
||||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ ol.geom.Polygon.prototype.appendLinearRing = function(linearRing) {
|
|||||||
ol.array.safeExtend(this.flatCoordinates, linearRing.getFlatCoordinates());
|
ol.array.safeExtend(this.flatCoordinates, linearRing.getFlatCoordinates());
|
||||||
}
|
}
|
||||||
this.ends_.push(this.flatCoordinates.length);
|
this.ends_.push(this.flatCoordinates.length);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -312,7 +312,7 @@ ol.geom.Polygon.prototype.setCoordinates = function(coordinates, opt_layout) {
|
|||||||
var ends = ol.geom.flat.deflate.coordinatess(
|
var ends = ol.geom.flat.deflate.coordinatess(
|
||||||
this.flatCoordinates, 0, coordinates, this.stride, this.ends_);
|
this.flatCoordinates, 0, coordinates, this.stride, this.ends_);
|
||||||
this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];
|
this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -333,7 +333,7 @@ ol.geom.Polygon.prototype.setFlatCoordinates =
|
|||||||
}
|
}
|
||||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||||
this.ends_ = ends;
|
this.ends_ = ends;
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ ol.geom.SimpleGeometry.prototype.setLayout =
|
|||||||
ol.geom.SimpleGeometry.prototype.applyTransform = function(transformFn) {
|
ol.geom.SimpleGeometry.prototype.applyTransform = function(transformFn) {
|
||||||
if (!goog.isNull(this.flatCoordinates)) {
|
if (!goog.isNull(this.flatCoordinates)) {
|
||||||
transformFn(this.flatCoordinates, this.flatCoordinates, this.stride);
|
transformFn(this.flatCoordinates, this.flatCoordinates, this.stride);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -93,7 +93,7 @@ ol.Image.prototype.getImageElement = function(opt_context) {
|
|||||||
ol.Image.prototype.handleImageError_ = function() {
|
ol.Image.prototype.handleImageError_ = function() {
|
||||||
this.state = ol.ImageState.ERROR;
|
this.state = ol.ImageState.ERROR;
|
||||||
this.unlistenImage_();
|
this.unlistenImage_();
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ ol.Image.prototype.handleImageError_ = function() {
|
|||||||
ol.Image.prototype.handleImageLoad_ = function() {
|
ol.Image.prototype.handleImageLoad_ = function() {
|
||||||
this.state = ol.ImageState.LOADED;
|
this.state = ol.ImageState.LOADED;
|
||||||
this.unlistenImage_();
|
this.unlistenImage_();
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -69,7 +69,7 @@ goog.inherits(ol.ImageBase, goog.events.EventTarget);
|
|||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
ol.ImageBase.prototype.dispatchChangeEvent = function() {
|
ol.ImageBase.prototype.changed = function() {
|
||||||
this.dispatchEvent(goog.events.EventType.CHANGE);
|
this.dispatchEvent(goog.events.EventType.CHANGE);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -103,7 +103,7 @@ ol.ImageTile.prototype.getKey = function() {
|
|||||||
ol.ImageTile.prototype.handleImageError_ = function() {
|
ol.ImageTile.prototype.handleImageError_ = function() {
|
||||||
this.state = ol.TileState.ERROR;
|
this.state = ol.TileState.ERROR;
|
||||||
this.unlistenImage_();
|
this.unlistenImage_();
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ ol.ImageTile.prototype.handleImageLoad_ = function() {
|
|||||||
this.state = ol.TileState.EMPTY;
|
this.state = ol.TileState.EMPTY;
|
||||||
}
|
}
|
||||||
this.unlistenImage_();
|
this.unlistenImage_();
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -99,5 +99,5 @@ ol.layer.Layer.prototype.getSourceState = function() {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.layer.Layer.prototype.handleSourceChange_ = function() {
|
ol.layer.Layer.prototype.handleSourceChange_ = function() {
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ goog.inherits(ol.layer.Group, ol.layer.Base);
|
|||||||
*/
|
*/
|
||||||
ol.layer.Group.prototype.handleLayerChange_ = function() {
|
ol.layer.Group.prototype.handleLayerChange_ = function() {
|
||||||
if (this.getVisible()) {
|
if (this.getVisible()) {
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ ol.layer.Group.prototype.handleLayersChanged_ = function(event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ ol.layer.Group.prototype.handleLayersAdd_ = function(collectionEvent) {
|
|||||||
this.listenerKeys_[goog.getUid(layer).toString()] = goog.events.listen(
|
this.listenerKeys_[goog.getUid(layer).toString()] = goog.events.listen(
|
||||||
layer, [ol.ObjectEventType.PROPERTYCHANGE, goog.events.EventType.CHANGE],
|
layer, [ol.ObjectEventType.PROPERTYCHANGE, goog.events.EventType.CHANGE],
|
||||||
this.handleLayerChange_, false, this);
|
this.handleLayerChange_, false, this);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ ol.layer.Group.prototype.handleLayersRemove_ = function(collectionEvent) {
|
|||||||
var key = goog.getUid(layer).toString();
|
var key = goog.getUid(layer).toString();
|
||||||
goog.events.unlistenByKey(this.listenerKeys_[key]);
|
goog.events.unlistenByKey(this.listenerKeys_[key]);
|
||||||
delete this.listenerKeys_[key];
|
delete this.listenerKeys_[key];
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -121,5 +121,5 @@ ol.layer.Vector.prototype.setStyle = function(style) {
|
|||||||
this.style_ = goog.isDef(style) ? style : ol.style.defaultStyleFunction;
|
this.style_ = goog.isDef(style) ? style : ol.style.defaultStyleFunction;
|
||||||
this.styleFunction_ = goog.isNull(style) ?
|
this.styleFunction_ = goog.isNull(style) ?
|
||||||
undefined : ol.style.createStyleFunction(this.style_);
|
undefined : ol.style.createStyleFunction(this.style_);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ goog.require('goog.events.EventType');
|
|||||||
* instantiated in apps.
|
* instantiated in apps.
|
||||||
* An event target providing convenient methods for listener registration
|
* An event target providing convenient methods for listener registration
|
||||||
* and unregistration. A generic `change` event is always available through
|
* and unregistration. A generic `change` event is always available through
|
||||||
* {@link ol.Observable#dispatchChangeEvent}.
|
* {@link ol.Observable#changed}.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {goog.events.EventTarget}
|
* @extends {goog.events.EventTarget}
|
||||||
@@ -35,11 +35,11 @@ goog.inherits(ol.Observable, goog.events.EventTarget);
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatches a `change` event.
|
* Increases the revision counter and disptches a 'change' event.
|
||||||
* @fires change
|
* @fires change
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.Observable.prototype.dispatchChangeEvent = function() {
|
ol.Observable.prototype.changed = function() {
|
||||||
++this.revision_;
|
++this.revision_;
|
||||||
this.dispatchEvent(goog.events.EventType.CHANGE);
|
this.dispatchEvent(goog.events.EventType.CHANGE);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ ol.source.Cluster.prototype.onSourceChange_ = function() {
|
|||||||
this.clear();
|
this.clear();
|
||||||
this.cluster_();
|
this.cluster_();
|
||||||
this.addFeatures(this.features_);
|
this.addFeatures(this.features_);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ ol.source.ImageMapGuide.getScale = function(extent, size, metersPerUnit, dpi) {
|
|||||||
*/
|
*/
|
||||||
ol.source.ImageMapGuide.prototype.updateParams = function(params) {
|
ol.source.ImageMapGuide.prototype.updateParams = function(params) {
|
||||||
goog.object.extend(this.params_, params);
|
goog.object.extend(this.params_, params);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ ol.source.ImageVector.prototype.getTransform_ =
|
|||||||
*/
|
*/
|
||||||
ol.source.ImageVector.prototype.handleImageChange_ =
|
ol.source.ImageVector.prototype.handleImageChange_ =
|
||||||
function(event) {
|
function(event) {
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ ol.source.ImageWMS.prototype.setUrl = function(url) {
|
|||||||
if (url != this.url_) {
|
if (url != this.url_) {
|
||||||
this.url_ = url;
|
this.url_ = url;
|
||||||
this.image_ = null;
|
this.image_ = null;
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -333,7 +333,7 @@ ol.source.ImageWMS.prototype.updateParams = function(params) {
|
|||||||
goog.object.extend(this.params_, params);
|
goog.object.extend(this.params_, params);
|
||||||
this.updateV13_();
|
this.updateV13_();
|
||||||
this.image_ = null;
|
this.image_ = null;
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ ol.source.Source.prototype.setLogo = function(logo) {
|
|||||||
*/
|
*/
|
||||||
ol.source.Source.prototype.setState = function(state) {
|
ol.source.Source.prototype.setState = function(state) {
|
||||||
this.state_ = state;
|
this.state_ = state;
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ ol.source.TileImage.prototype.getTileUrlFunction = function() {
|
|||||||
ol.source.TileImage.prototype.setTileLoadFunction = function(tileLoadFunction) {
|
ol.source.TileImage.prototype.setTileLoadFunction = function(tileLoadFunction) {
|
||||||
this.tileCache.clear();
|
this.tileCache.clear();
|
||||||
this.tileLoadFunction = tileLoadFunction;
|
this.tileLoadFunction = tileLoadFunction;
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ ol.source.TileImage.prototype.setTileUrlFunction = function(tileUrlFunction) {
|
|||||||
// FIXME cache key somehow.
|
// FIXME cache key somehow.
|
||||||
this.tileCache.clear();
|
this.tileCache.clear();
|
||||||
this.tileUrlFunction = tileUrlFunction;
|
this.tileUrlFunction = tileUrlFunction;
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ ol.source.TileVector.prototype.removeFeature = goog.abstractMethod;
|
|||||||
*/
|
*/
|
||||||
ol.source.TileVector.prototype.setTileUrlFunction = function(tileUrlFunction) {
|
ol.source.TileVector.prototype.setTileUrlFunction = function(tileUrlFunction) {
|
||||||
this.tileUrlFunction_ = tileUrlFunction;
|
this.tileUrlFunction_ = tileUrlFunction;
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -341,7 +341,7 @@ ol.source.TileWMS.prototype.setUrl = function(url) {
|
|||||||
ol.source.TileWMS.prototype.setUrls = function(urls) {
|
ol.source.TileWMS.prototype.setUrls = function(urls) {
|
||||||
this.urls_ = goog.isDefAndNotNull(urls) ? urls : [];
|
this.urls_ = goog.isDefAndNotNull(urls) ? urls : [];
|
||||||
this.resetCoordKeyPrefix_();
|
this.resetCoordKeyPrefix_();
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -407,7 +407,7 @@ ol.source.TileWMS.prototype.updateParams = function(params) {
|
|||||||
goog.object.extend(this.params_, params);
|
goog.object.extend(this.params_, params);
|
||||||
this.resetCoordKeyPrefix_();
|
this.resetCoordKeyPrefix_();
|
||||||
this.updateV13_();
|
this.updateV13_();
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ goog.inherits(ol.source.Vector, ol.source.Source);
|
|||||||
*/
|
*/
|
||||||
ol.source.Vector.prototype.addFeature = function(feature) {
|
ol.source.Vector.prototype.addFeature = function(feature) {
|
||||||
this.addFeatureInternal(feature);
|
this.addFeatureInternal(feature);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ ol.source.Vector.prototype.addFeatureInternal = function(feature) {
|
|||||||
*/
|
*/
|
||||||
ol.source.Vector.prototype.addFeatures = function(features) {
|
ol.source.Vector.prototype.addFeatures = function(features) {
|
||||||
this.addFeaturesInternal(features);
|
this.addFeaturesInternal(features);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ ol.source.Vector.prototype.clear = function() {
|
|||||||
this.nullGeometryFeatures_, this.removeFeatureInternal, this);
|
this.nullGeometryFeatures_, this.removeFeatureInternal, this);
|
||||||
goog.object.clear(this.nullGeometryFeatures_);
|
goog.object.clear(this.nullGeometryFeatures_);
|
||||||
goog.asserts.assert(goog.object.isEmpty(this.featureChangeKeys_));
|
goog.asserts.assert(goog.object.isEmpty(this.featureChangeKeys_));
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -403,7 +403,7 @@ ol.source.Vector.prototype.handleFeatureChange_ = function(event) {
|
|||||||
goog.asserts.assert(this.undefIdIndex_[featureKey] === feature);
|
goog.asserts.assert(this.undefIdIndex_[featureKey] === feature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -436,7 +436,7 @@ ol.source.Vector.prototype.removeFeature = function(feature) {
|
|||||||
this.rBush_.remove(feature);
|
this.rBush_.remove(feature);
|
||||||
}
|
}
|
||||||
this.removeFeatureInternal(feature);
|
this.removeFeatureInternal(feature);
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ ol.source.WMTS.prototype.resetCoordKeyPrefix_ = function() {
|
|||||||
ol.source.WMTS.prototype.updateDimensions = function(dimensions) {
|
ol.source.WMTS.prototype.updateDimensions = function(dimensions) {
|
||||||
goog.object.extend(this.dimensions_, dimensions);
|
goog.object.extend(this.dimensions_, dimensions);
|
||||||
this.resetCoordKeyPrefix_();
|
this.resetCoordKeyPrefix_();
|
||||||
this.dispatchChangeEvent();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ goog.inherits(ol.Tile, goog.events.EventTarget);
|
|||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
ol.Tile.prototype.dispatchChangeEvent = function() {
|
ol.Tile.prototype.changed = function() {
|
||||||
this.dispatchEvent(goog.events.EventType.CHANGE);
|
this.dispatchEvent(goog.events.EventType.CHANGE);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user