Adding a 'sketchstarted' event on the vector layer. This event is triggered at the start of each new sketch. r=ahocevar (closes #1945)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@9269 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -37,11 +37,13 @@ OpenLayers.Handler.Polygon = OpenLayers.Class(OpenLayers.Handler.Path, {
|
||||
* handler
|
||||
*
|
||||
* Named callbacks:
|
||||
* done - Called when the point drawing is finished. The callback will
|
||||
* recieve a single argument, the polygon geometry.
|
||||
* point - Called as each point is added. Receives the new point geometry.
|
||||
* create - Called when a sketch is first created. Callback called with
|
||||
* the creation point geometry and sketch feature.
|
||||
* modify - Called with each move of a vertex with the vertex (point)
|
||||
* geometry and the sketch feature.
|
||||
* point - Called as each point is added. Receives the new point geometry.
|
||||
* done - Called when the point drawing is finished. The callback will
|
||||
* recieve a single argument, the polygon geometry.
|
||||
* cancel - Called when the handler is deactivated while drawing. The
|
||||
* cancel callback will receive a geometry.
|
||||
*/
|
||||
@@ -68,6 +70,8 @@ OpenLayers.Handler.Polygon = OpenLayers.Class(OpenLayers.Handler.Path, {
|
||||
this.polygon = new OpenLayers.Feature.Vector(
|
||||
new OpenLayers.Geometry.Polygon([this.line.geometry])
|
||||
);
|
||||
this.callback("create", [this.point.geometry, this.getSketch()]);
|
||||
this.point.geometry.clearBounds();
|
||||
this.layer.addFeatures([this.polygon, this.point], {silent: true});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user