Added hitTolerance to TranslateInteraction
This commit is contained in:
+12
-1
@@ -2910,7 +2910,8 @@ olx.interaction.ExtentOptions.prototype.wrapX;
|
|||||||
/**
|
/**
|
||||||
* @typedef {{
|
* @typedef {{
|
||||||
* features: (ol.Collection.<ol.Feature>|undefined),
|
* features: (ol.Collection.<ol.Feature>|undefined),
|
||||||
* layers: (undefined|Array.<ol.layer.Layer>|function(ol.layer.Layer): boolean)
|
* layers: (undefined|Array.<ol.layer.Layer>|function(ol.layer.Layer): boolean),
|
||||||
|
* hitTolerance: (number|undefined)
|
||||||
* }}
|
* }}
|
||||||
*/
|
*/
|
||||||
olx.interaction.TranslateOptions;
|
olx.interaction.TranslateOptions;
|
||||||
@@ -2937,6 +2938,16 @@ olx.interaction.TranslateOptions.prototype.features;
|
|||||||
olx.interaction.TranslateOptions.prototype.layers;
|
olx.interaction.TranslateOptions.prototype.layers;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hit-detection tolerance. Pixels inside the radius around the given position
|
||||||
|
* will be checked for features. This only works for the canvas renderer and
|
||||||
|
* not for WebGL.
|
||||||
|
* @type {number|undefined}
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
olx.interaction.TranslateOptions.prototype.hitTolerance;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{condition: (ol.EventsConditionType|undefined),
|
* @typedef {{condition: (ol.EventsConditionType|undefined),
|
||||||
* duration: (number|undefined),
|
* duration: (number|undefined),
|
||||||
|
|||||||
@@ -82,6 +82,10 @@ ol.interaction.Select = function(opt_options) {
|
|||||||
this.filter_ = options.filter ? options.filter :
|
this.filter_ = options.filter ? options.filter :
|
||||||
ol.functions.TRUE;
|
ol.functions.TRUE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
this.hitTolerance_ = options.hitTolerance ? options.hitTolerance : 0;
|
this.hitTolerance_ = options.hitTolerance ? options.hitTolerance : 0;
|
||||||
|
|
||||||
var featureOverlay = new ol.layer.Vector({
|
var featureOverlay = new ol.layer.Vector({
|
||||||
|
|||||||
@@ -70,6 +70,12 @@ ol.interaction.Translate = function(opt_options) {
|
|||||||
*/
|
*/
|
||||||
this.layerFilter_ = layerFilter;
|
this.layerFilter_ = layerFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
this.hitTolerance_ = options.hitTolerance ? options.hitTolerance : 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ol.Feature}
|
* @type {ol.Feature}
|
||||||
* @private
|
* @private
|
||||||
@@ -198,11 +204,34 @@ ol.interaction.Translate.prototype.featuresAtPixel_ = function(pixel, map) {
|
|||||||
return feature;
|
return feature;
|
||||||
}
|
}
|
||||||
}, this, {
|
}, this, {
|
||||||
layerFilter: this.layerFilter_
|
layerFilter: this.layerFilter_,
|
||||||
|
hitTolerance: this.hitTolerance_
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Hit-detection tolerance.
|
||||||
|
* @returns {number} Hit tolerance.
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
ol.interaction.Translate.prototype.getHitTolerance = function() {
|
||||||
|
return this.hitTolerance_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hit-detection tolerance. Pixels inside the radius around the given position
|
||||||
|
* will be checked for features. This only works for the canvas renderer and
|
||||||
|
* not for WebGL.
|
||||||
|
* @param {number} hitTolerance Hit tolerance.
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
ol.interaction.Translate.prototype.setHitTolerance = function(hitTolerance) {
|
||||||
|
this.hitTolerance_ = hitTolerance;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
* Events emitted by {@link ol.interaction.Translate} instances are instances of
|
* Events emitted by {@link ol.interaction.Translate} instances are instances of
|
||||||
|
|||||||
Reference in New Issue
Block a user