Adding a persist option to the measure control. This passes the same to the sketch handler. The cancel method on the control calls the same on the handler. Patch from dwins. Tests from me. r=me (closes #2029)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@9225 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -67,6 +67,15 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||
english: ['mi', 'ft', 'in'],
|
||||
metric: ['km', 'm']
|
||||
},
|
||||
|
||||
/**
|
||||
* APIProperty: persist
|
||||
* {Boolean} Keep the temporary measurement sketch drawn after the
|
||||
* measurement is complete. The geometry will persist until a new
|
||||
* measurement is started, the control is deactivated, or <cancel> is
|
||||
* called.
|
||||
*/
|
||||
persist: false,
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Control.Measure
|
||||
@@ -86,9 +95,24 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||
{done: this.measureComplete, point: this.measurePartial},
|
||||
this.callbacks
|
||||
);
|
||||
|
||||
// let the handler options override, so old code that passes 'persist'
|
||||
// directly to the handler does not need an update
|
||||
this.handlerOptions = OpenLayers.Util.extend(
|
||||
{persist: this.persist}, this.handlerOptions
|
||||
);
|
||||
this.handler = new handler(this, this.callbacks, this.handlerOptions);
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: cancel
|
||||
* Stop the control from measuring. If <persist> is true, the temporary
|
||||
* sketch will be erased.
|
||||
*/
|
||||
cancel: function() {
|
||||
this.handler.cancel();
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: updateHandler
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user