From 4f2b6a0c22799a697b217ec2877cef986fd97d8b Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Tue, 14 Aug 2012 18:21:45 +0200 Subject: [PATCH] Initialize all member variables in constructor --- src/ol/base/mapbrowserevent.js | 13 +++++---- src/ol/control/mouseposition.js | 13 +++++---- src/ol/interaction/altdragrotate.js | 15 ++++++----- src/ol/interaction/shiftdragrotateandzoom.js | 28 ++++++++++---------- 4 files changed, 34 insertions(+), 35 deletions(-) diff --git a/src/ol/base/mapbrowserevent.js b/src/ol/base/mapbrowserevent.js index 6466e4a9fc..5c9421531d 100644 --- a/src/ol/base/mapbrowserevent.js +++ b/src/ol/base/mapbrowserevent.js @@ -23,17 +23,16 @@ ol.MapBrowserEvent = function(type, map, browserEvent) { */ this.browserEvent = browserEvent; + /** + * @private + * @type {ol.Coordinate|undefined} + */ + this.coordinate_ = undefined; + }; goog.inherits(ol.MapBrowserEvent, ol.MapEvent); -/** - * @private - * @type {ol.Coordinate|undefined} - */ -ol.MapBrowserEvent.prototype.coordinate_; - - /** * @return {ol.Coordinate|undefined} Coordinate. */ diff --git a/src/ol/control/mouseposition.js b/src/ol/control/mouseposition.js index 4288772805..52f7ca220d 100644 --- a/src/ol/control/mouseposition.js +++ b/src/ol/control/mouseposition.js @@ -49,6 +49,12 @@ ol.control.MousePosition = */ this.undefinedHTML_ = opt_undefinedHTML || ''; + /** + * @private + * @type {ol.TransformFunction} + */ + this.transform_ = ol.Projection.identityTransform; + goog.events.listen(map, ol.Object.getChangedEventType(ol.MapProperty.PROJECTION), this.handleMapProjectionChanged, false, this); @@ -65,13 +71,6 @@ ol.control.MousePosition = goog.inherits(ol.control.MousePosition, ol.Control); -/** - * @private - * @type {ol.TransformFunction} - */ -ol.control.MousePosition.prototype.transform_; - - /** * @inheritDoc */ diff --git a/src/ol/interaction/altdragrotate.js b/src/ol/interaction/altdragrotate.js index 5c42c4d434..50dc5c0980 100644 --- a/src/ol/interaction/altdragrotate.js +++ b/src/ol/interaction/altdragrotate.js @@ -11,18 +11,19 @@ goog.require('ol.interaction.Drag'); * @param {ol.interaction.Constraints} constraints Constraints. */ ol.interaction.AltDragRotate = function(constraints) { + goog.base(this, constraints); + + /** + * @private + * @type {number} + */ + this.startRotation_ = 0; + }; goog.inherits(ol.interaction.AltDragRotate, ol.interaction.Drag); -/** - * @private - * @type {number} - */ -ol.interaction.AltDragRotate.prototype.startRotation_; - - /** * @inheritDoc */ diff --git a/src/ol/interaction/shiftdragrotateandzoom.js b/src/ol/interaction/shiftdragrotateandzoom.js index 748209c412..ec779a9088 100644 --- a/src/ol/interaction/shiftdragrotateandzoom.js +++ b/src/ol/interaction/shiftdragrotateandzoom.js @@ -13,25 +13,25 @@ goog.require('ol.interaction.Drag'); * @param {ol.interaction.Constraints} constraints Constraints. */ ol.interaction.ShiftDragRotateAndZoom = function(constraints) { + goog.base(this, constraints); + + /** + * @private + * @type {number} + */ + this.startRatio_ = 0; + + /** + * @private + * @type {number} + */ + this.startRotation_ = 0; + }; goog.inherits(ol.interaction.ShiftDragRotateAndZoom, ol.interaction.Drag); -/** - * @private - * @type {number} - */ -ol.interaction.ShiftDragRotateAndZoom.prototype.startRatio_; - - -/** - * @private - * @type {number} - */ -ol.interaction.ShiftDragRotateAndZoom.prototype.startRotation_; - - /** * @inheritDoc */