Added boxEndCondition to DragBoxOptions to replace the hardcoded check against DRAG_BOX_HYSTERESIS_PIXELS_SQUARED.

This commit is contained in:
Philip "digitalfox" Kovac
2015-12-16 15:24:58 -05:00
parent 15be53e98c
commit 10e2510f0f
2 changed files with 57 additions and 6 deletions

View File

@@ -2361,7 +2361,8 @@ olx.interaction.DragAndDropOptions.prototype.projection;
/**
* @typedef {{className: (string|undefined),
* condition: (ol.events.ConditionType|undefined)}}
* condition: (ol.events.ConditionType|undefined),
* boxEndCondition: (ol.interaction.DragBoxEndConditionType|undefined)}}
* @api
*/
olx.interaction.DragBoxOptions;
@@ -2385,6 +2386,25 @@ olx.interaction.DragBoxOptions.prototype.className;
olx.interaction.DragBoxOptions.prototype.condition;
/**
* A function that takes a {@link ol.MapBrowserEvent} and two
* {@link ol.Pixel}s to indicate whether a boxend event should be fired.
* Default is:
* ```js
* function(mapBrowserEvent,
* startPixel, endPixel) {
* var width = endPixel[0] - startPixel[0];
* var height = endPixel[1] - startPixel[1];
* return width * width + height * height >=
* ol.DRAG_BOX_HYSTERESIS_PIXELS_SQUARED;
* }
* ```
* @type {ol.interaction.DragBoxEndConditionType|undefined}
* @api
*/
olx.interaction.DragBoxOptions.prototype.boxEndCondition;
/**
* @typedef {{kinetic: (ol.Kinetic|undefined)}}
* @api