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:
@@ -115,16 +115,19 @@ OpenLayers.Handler.RegularPolygon = OpenLayers.Class(OpenLayers.Handler.Drag, {
|
||||
*
|
||||
* Parameters:
|
||||
* control - {<OpenLayers.Control>} The control that owns this handler
|
||||
* callbacks - {Array} An object with a 'done' property whos value is a
|
||||
* function to be called when the polygon drawing is finished.
|
||||
* The callback should expect to recieve a single argument,
|
||||
* the polygon geometry. If the callbacks object contains a
|
||||
* 'cancel' property, this function will be called when the
|
||||
* handler is deactivated while drawing. The cancel should
|
||||
* expect to receive a geometry.
|
||||
* callbacks - {Object} An object with a properties whose values are
|
||||
* functions. Various callbacks described below.
|
||||
* options - {Object} An object with properties to be set on the handler.
|
||||
* If the options.sides property is not specified, the number of sides
|
||||
* will default to 4.
|
||||
*
|
||||
* Named callbacks:
|
||||
* create - Called when a sketch is first created. Callback called with
|
||||
* the creation point geometry and sketch feature.
|
||||
* done - Called when the sketch drawing is finished. The callback will
|
||||
* recieve a single argument, the sketch geometry.
|
||||
* cancel - Called when the handler is deactivated while drawing. The
|
||||
* cancel callback will receive a geometry.
|
||||
*/
|
||||
initialize: function(control, callbacks, options) {
|
||||
this.style = OpenLayers.Util.extend(OpenLayers.Feature.Vector.style['default'], {});
|
||||
@@ -225,6 +228,7 @@ OpenLayers.Handler.RegularPolygon = OpenLayers.Class(OpenLayers.Handler.Drag, {
|
||||
}
|
||||
this.feature = new OpenLayers.Feature.Vector();
|
||||
this.createGeometry();
|
||||
this.callback("create", [this.origin, this.feature]);
|
||||
this.layer.addFeatures([this.feature], {silent: true});
|
||||
this.layer.drawFeature(this.feature, this.style);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user