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:
@@ -284,7 +284,7 @@ OpenLayers.Handler.Point = OpenLayers.Class(OpenLayers.Handler, {
|
|||||||
if(cancel || !this.persist) {
|
if(cancel || !this.persist) {
|
||||||
this.destroyFeature();
|
this.destroyFeature();
|
||||||
}
|
}
|
||||||
if(!noNew) {
|
if(!noNew && this.active) {
|
||||||
this.createFeature();
|
this.createFeature();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_Handler_Point_activation(t) {
|
function test_Handler_Point_activation(t) {
|
||||||
t.plan(10);
|
t.plan(11);
|
||||||
var log = [];
|
var log = [];
|
||||||
var map = new OpenLayers.Map("map", {
|
var map = new OpenLayers.Map("map", {
|
||||||
resolutions: [1]
|
resolutions: [1]
|
||||||
@@ -70,7 +70,15 @@
|
|||||||
activated = handler.deactivate();
|
activated = handler.deactivate();
|
||||||
t.ok(activated,
|
t.ok(activated,
|
||||||
"deactivate returns true if the handler was active already");
|
"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();
|
map.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user