add support for maxVertices in Hander.Path, p=me,r=erilem, thanks erilem for the updated patch and your great work on this (closes #2779)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11797 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -26,6 +26,15 @@ OpenLayers.Handler.Path = OpenLayers.Class(OpenLayers.Handler.Point, {
|
||||
*/
|
||||
line: null,
|
||||
|
||||
/**
|
||||
* APIProperty: maxVertices
|
||||
* {Number} The maximum number of vertices which can be drawn by this
|
||||
* handler. When the number of vertices reaches maxVertices, the
|
||||
* geometry is automatically finalized. This property doesn't
|
||||
* apply if freehand is set. Default is null.
|
||||
*/
|
||||
maxVertices: null,
|
||||
|
||||
/**
|
||||
* Property: freehand
|
||||
* {Boolean} In freehand mode, the handler starts the path on mouse down,
|
||||
@@ -328,6 +337,9 @@ OpenLayers.Handler.Path = OpenLayers.Class(OpenLayers.Handler.Point, {
|
||||
}
|
||||
this.addPoint(evt.xy);
|
||||
this.lastUp = evt.xy;
|
||||
if(this.line.geometry.components.length === this.maxVertices + 1) {
|
||||
this.finishGeometry();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user