Draw and modify controls now set feature state. No longer do we need to check feature state in app code in cases where features are created or modified with these controls. r=elemoine,ahocevar (closes #1833)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@8382 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -446,11 +446,24 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
dragComplete: function(vertex) {
|
||||
this.resetVertices();
|
||||
this.setFeatureState();
|
||||
this.onModification(this.feature);
|
||||
this.layer.events.triggerEvent("featuremodified",
|
||||
{feature: this.feature});
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: setFeatureState
|
||||
* Called when the feature is modified. If the current state is not
|
||||
* INSERT or DELETE, the state is set to UPDATE.
|
||||
*/
|
||||
setFeatureState: function() {
|
||||
if(this.feature.state != OpenLayers.State.INSERT &&
|
||||
this.feature.state != OpenLayers.State.DELETE) {
|
||||
this.feature.state = OpenLayers.State.UPDATE;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: resetVertices
|
||||
*/
|
||||
@@ -522,6 +535,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
this.layer.drawFeature(this.feature,
|
||||
this.selectControl.renderIntent);
|
||||
this.resetVertices();
|
||||
this.setFeatureState();
|
||||
this.onModification(this.feature);
|
||||
this.layer.events.triggerEvent("featuremodified",
|
||||
{feature: this.feature});
|
||||
|
||||
Reference in New Issue
Block a user