From 4da61e8ae9f7fc78df7971cbb3b10219d59717ad Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Mon, 22 Apr 2013 16:30:55 +0200 Subject: [PATCH] Configure ol.interaction.TouchRotate with options --- src/objectliterals.jsdoc | 5 +++++ src/ol/interaction/touchrotateinteraction.js | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index a66bc2a5a8..b3e43feb4e 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -229,6 +229,11 @@ * @property {ol.Kinetic|undefined} kinetic Kinetic. */ +/** + * @typedef {Object} ol.interaction.TouchRotateOptions + * @property {number|undefined} threshold Minimal angle to start a rotation. + */ + /** * @typedef {Object} ol.layer.LayerOptions * @property {number|undefined} brightness Brightness. diff --git a/src/ol/interaction/touchrotateinteraction.js b/src/ol/interaction/touchrotateinteraction.js index d7ffb146f5..e0e4c9e937 100644 --- a/src/ol/interaction/touchrotateinteraction.js +++ b/src/ol/interaction/touchrotateinteraction.js @@ -21,13 +21,14 @@ ol.interaction.TOUCHROTATE_ANIMATION_DURATION = 250; /** * @constructor * @extends {ol.interaction.Touch} - * @param {number=} opt_threshold Minimal angle to start a rotation. - * Default to 0.3 (radian). + * @param {ol.interaction.TouchRotateOptions=} opt_options Options. */ -ol.interaction.TouchRotate = function(opt_threshold) { +ol.interaction.TouchRotate = function(opt_options) { goog.base(this); + var options = goog.isDef(opt_options) ? opt_options : {}; + /** * @private * @type {ol.Coordinate} @@ -56,7 +57,7 @@ ol.interaction.TouchRotate = function(opt_threshold) { * @private * @type {number} */ - this.threshold_ = goog.isDef(opt_threshold) ? opt_threshold : 0.3; + this.threshold_ = goog.isDef(options.threshold) ? options.threshold : 0.3; }; goog.inherits(ol.interaction.TouchRotate, ol.interaction.Touch);