Fix Snap -> Interaction

This commit changes ol.Snap -> ol.interaction.Snap, which extends
ol.interaction.Pointer.  The 'pointerdown', 'pointermove' and
'pointerup' map browser events are hanlded to edit the pixel and
coordinate properties to make them 'snap' to the closest feature.
This commit is contained in:
Alexandre Dubé
2015-03-25 15:10:41 -04:00
parent 7d20e2a317
commit d92917ac89
4 changed files with 766 additions and 1 deletions
+37 -1
View File
@@ -2450,7 +2450,7 @@ olx.interaction.ModifyOptions.prototype.deleteCondition;
/**
* Pixel tolerance for considering the pointer close enough to a segment or
* vertex for editing. Default is `10` pixels.
* vertex for editing.
* @type {number|undefined}
* @api
*/
@@ -2671,6 +2671,42 @@ olx.interaction.SelectOptions.prototype.toggleCondition;
olx.interaction.SelectOptions.prototype.multi;
/**
* Options for snap
* @typedef {{
* features: (Array.<ol.Feature>|ol.Collection.<ol.Feature>|undefined),
* pixelTolerance: (number|undefined),
* source: (ol.source.Vector|undefined)
* }}
* @api
*/
olx.interaction.SnapOptions;
/**
* Snap to this features
* @type {Array.<ol.Feature>|ol.Collection.<ol.Feature>|undefined}
* @api
*/
olx.interaction.SnapOptions.prototype.features;
/**
* Pixel tolerance for considering the pointer close enough to a segment or
* vertex for editing. Default is `10` pixels.
* @type {number|undefined}
* @api
*/
olx.interaction.SnapOptions.prototype.pixelTolerance;
/**
* Snap to features from this source
* @type {ol.source.Vector|undefined}
*/
olx.interaction.SnapOptions.prototype.source;
/**
* Namespace.
* @type {Object}