Point Handler should not create feature if it is not active anymore, p=me,erilem r=ahocevar (closes #3172)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11701 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
bartvde
2011-03-12 16:03:57 +00:00
parent 770a0f31f5
commit 318003d399
2 changed files with 11 additions and 3 deletions

View File

@@ -284,7 +284,7 @@ OpenLayers.Handler.Point = OpenLayers.Class(OpenLayers.Handler, {
if(cancel || !this.persist) {
this.destroyFeature();
}
if(!noNew) {
if(!noNew && this.active) {
this.createFeature();
}
},

View File

@@ -25,7 +25,7 @@
}
function test_Handler_Point_activation(t) {
t.plan(10);
t.plan(11);
var log = [];
var map = new OpenLayers.Map("map", {
resolutions: [1]
@@ -70,7 +70,15 @@
activated = handler.deactivate();
t.ok(activated,
"deactivate returns true if the handler was active already");
var failed = false;
try {
handler.finalize();
msg = "finalizing after deactivation does not throw an error";
} catch (err) {
failed = true;
msg = "finalizing after deactivation throws an error";
}
t.ok(!failed, msg);
map.destroy();
}