Merge pull request #7355 from marcosox/master

Pass pixel tolerance as a parameter to constructor of ol.interaction.Extent
This commit is contained in:
Tim Schaub
2017-10-17 08:44:42 -06:00
committed by GitHub
2 changed files with 13 additions and 1 deletions
+9
View File
@@ -3138,6 +3138,7 @@ olx.interaction.DrawOptions.prototype.wrapX;
/** /**
* @typedef {{extent: (ol.Extent|undefined), * @typedef {{extent: (ol.Extent|undefined),
* boxStyle: (ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction|undefined), * boxStyle: (ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction|undefined),
* pixelTolerance: (number|undefined),
* pointerStyle: (ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction|undefined), * pointerStyle: (ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction|undefined),
* wrapX: (boolean|undefined)}} * wrapX: (boolean|undefined)}}
* @api * @api
@@ -3159,6 +3160,14 @@ olx.interaction.ExtentOptions.prototype.extent;
*/ */
olx.interaction.ExtentOptions.prototype.boxStyle; olx.interaction.ExtentOptions.prototype.boxStyle;
/**
* Pixel tolerance for considering the pointer close enough to a segment or
* vertex for editing. Default is `10`.
* @type {number|undefined}
* @api
*/
olx.interaction.ExtentOptions.prototype.pixelTolerance;
/** /**
* Style for the cursor used to draw the extent. * Style for the cursor used to draw the extent.
* Defaults to ol.style.Style.createDefaultEditing()[ol.geom.GeometryType.POINT] * Defaults to ol.style.Style.createDefaultEditing()[ol.geom.GeometryType.POINT]
+4 -1
View File
@@ -31,6 +31,8 @@ goog.require('ol.style.Style');
*/ */
ol.interaction.Extent = function(opt_options) { ol.interaction.Extent = function(opt_options) {
var options = opt_options || {};
/** /**
* Extent of the drawn box * Extent of the drawn box
* @type {ol.Extent} * @type {ol.Extent}
@@ -50,7 +52,8 @@ ol.interaction.Extent = function(opt_options) {
* @type {number} * @type {number}
* @private * @private
*/ */
this.pixelTolerance_ = 10; this.pixelTolerance_ = options.pixelTolerance !== undefined ?
options.pixelTolerance : 10;
/** /**
* Is the pointer snapped to an extent vertex * Is the pointer snapped to an extent vertex