Remove goog.isDef from dragrotateandzoominteraction

This commit is contained in:
Marc Jansen
2015-09-22 10:19:41 +02:00
committed by Tim Schaub
parent 3e49fc6081
commit 35dfa6c811

View File

@@ -26,7 +26,7 @@ goog.require('ol.interaction.Pointer');
*/ */
ol.interaction.DragRotateAndZoom = function(opt_options) { ol.interaction.DragRotateAndZoom = function(opt_options) {
var options = goog.isDef(opt_options) ? opt_options : {}; var options = opt_options ? opt_options : {};
goog.base(this, { goog.base(this, {
handleDownEvent: ol.interaction.DragRotateAndZoom.handleDownEvent_, handleDownEvent: ol.interaction.DragRotateAndZoom.handleDownEvent_,
@@ -38,7 +38,7 @@ ol.interaction.DragRotateAndZoom = function(opt_options) {
* @private * @private
* @type {ol.events.ConditionType} * @type {ol.events.ConditionType}
*/ */
this.condition_ = goog.isDef(options.condition) ? this.condition_ = options.condition ?
options.condition : ol.events.condition.shiftKeyOnly; options.condition : ol.events.condition.shiftKeyOnly;
/** /**
@@ -63,7 +63,7 @@ ol.interaction.DragRotateAndZoom = function(opt_options) {
* @private * @private
* @type {number} * @type {number}
*/ */
this.duration_ = goog.isDef(options.duration) ? options.duration : 400; this.duration_ = options.duration ? options.duration : 400;
}; };
goog.inherits(ol.interaction.DragRotateAndZoom, ol.interaction.Pointer); goog.inherits(ol.interaction.DragRotateAndZoom, ol.interaction.Pointer);
@@ -89,17 +89,17 @@ ol.interaction.DragRotateAndZoom.handleDragEvent_ = function(mapBrowserEvent) {
var magnitude = delta.magnitude(); var magnitude = delta.magnitude();
var view = map.getView(); var view = map.getView();
map.render(); map.render();
if (goog.isDef(this.lastAngle_)) { if (this.lastAngle_ !== undefined) {
var angleDelta = theta - this.lastAngle_; var angleDelta = theta - this.lastAngle_;
ol.interaction.Interaction.rotateWithoutConstraints( ol.interaction.Interaction.rotateWithoutConstraints(
map, view, view.getRotation() - angleDelta); map, view, view.getRotation() - angleDelta);
} }
this.lastAngle_ = theta; this.lastAngle_ = theta;
if (goog.isDef(this.lastMagnitude_)) { if (this.lastMagnitude_ !== undefined) {
var resolution = this.lastMagnitude_ * (view.getResolution() / magnitude); var resolution = this.lastMagnitude_ * (view.getResolution() / magnitude);
ol.interaction.Interaction.zoomWithoutConstraints(map, view, resolution); ol.interaction.Interaction.zoomWithoutConstraints(map, view, resolution);
} }
if (goog.isDef(this.lastMagnitude_)) { if (this.lastMagnitude_ !== undefined) {
this.lastScaleDelta_ = this.lastMagnitude_ / magnitude; this.lastScaleDelta_ = this.lastMagnitude_ / magnitude;
} }
this.lastMagnitude_ = magnitude; this.lastMagnitude_ = magnitude;