Remove goog.isDef from interactiondefaults

This commit is contained in:
Marc Jansen
2015-09-22 10:20:54 +02:00
committed by Tim Schaub
parent 293c65088d
commit 241047795f
+10 -13
View File
@@ -41,19 +41,19 @@ goog.require('ol.interaction.PinchZoom');
*/ */
ol.interaction.defaults = function(opt_options) { ol.interaction.defaults = function(opt_options) {
var options = goog.isDef(opt_options) ? opt_options : {}; var options = opt_options ? opt_options : {};
var interactions = new ol.Collection(); var interactions = new ol.Collection();
var kinetic = new ol.Kinetic(-0.005, 0.05, 100); var kinetic = new ol.Kinetic(-0.005, 0.05, 100);
var altShiftDragRotate = goog.isDef(options.altShiftDragRotate) ? var altShiftDragRotate = options.altShiftDragRotate !== undefined ?
options.altShiftDragRotate : true; options.altShiftDragRotate : true;
if (altShiftDragRotate) { if (altShiftDragRotate) {
interactions.push(new ol.interaction.DragRotate()); interactions.push(new ol.interaction.DragRotate());
} }
var doubleClickZoom = goog.isDef(options.doubleClickZoom) ? var doubleClickZoom = options.doubleClickZoom !== undefined ?
options.doubleClickZoom : true; options.doubleClickZoom : true;
if (doubleClickZoom) { if (doubleClickZoom) {
interactions.push(new ol.interaction.DoubleClickZoom({ interactions.push(new ol.interaction.DoubleClickZoom({
@@ -62,30 +62,27 @@ ol.interaction.defaults = function(opt_options) {
})); }));
} }
var dragPan = goog.isDef(options.dragPan) ? var dragPan = options.dragPan !== undefined ? options.dragPan : true;
options.dragPan : true;
if (dragPan) { if (dragPan) {
interactions.push(new ol.interaction.DragPan({ interactions.push(new ol.interaction.DragPan({
kinetic: kinetic kinetic: kinetic
})); }));
} }
var pinchRotate = goog.isDef(options.pinchRotate) ? var pinchRotate = options.pinchRotate !== undefined ? options.pinchRotate :
options.pinchRotate : true; true;
if (pinchRotate) { if (pinchRotate) {
interactions.push(new ol.interaction.PinchRotate()); interactions.push(new ol.interaction.PinchRotate());
} }
var pinchZoom = goog.isDef(options.pinchZoom) ? var pinchZoom = options.pinchZoom !== undefined ? options.pinchZoom : true;
options.pinchZoom : true;
if (pinchZoom) { if (pinchZoom) {
interactions.push(new ol.interaction.PinchZoom({ interactions.push(new ol.interaction.PinchZoom({
duration: options.zoomDuration duration: options.zoomDuration
})); }));
} }
var keyboard = goog.isDef(options.keyboard) ? var keyboard = options.keyboard !== undefined ? options.keyboard : true;
options.keyboard : true;
if (keyboard) { if (keyboard) {
interactions.push(new ol.interaction.KeyboardPan()); interactions.push(new ol.interaction.KeyboardPan());
interactions.push(new ol.interaction.KeyboardZoom({ interactions.push(new ol.interaction.KeyboardZoom({
@@ -94,7 +91,7 @@ ol.interaction.defaults = function(opt_options) {
})); }));
} }
var mouseWheelZoom = goog.isDef(options.mouseWheelZoom) ? var mouseWheelZoom = options.mouseWheelZoom !== undefined ?
options.mouseWheelZoom : true; options.mouseWheelZoom : true;
if (mouseWheelZoom) { if (mouseWheelZoom) {
interactions.push(new ol.interaction.MouseWheelZoom({ interactions.push(new ol.interaction.MouseWheelZoom({
@@ -102,7 +99,7 @@ ol.interaction.defaults = function(opt_options) {
})); }));
} }
var shiftDragZoom = goog.isDef(options.shiftDragZoom) ? var shiftDragZoom = options.shiftDragZoom !== undefined ?
options.shiftDragZoom : true; options.shiftDragZoom : true;
if (shiftDragZoom) { if (shiftDragZoom) {
interactions.push(new ol.interaction.DragZoom()); interactions.push(new ol.interaction.DragZoom());