ModifyFeature: enable dragging without enabling vertex modifications. Special thanks to tschaub for the collaboration on all the changes to the modify feature control. And thanks to crschmidt for the review. (closes #1188)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@5467 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2007-12-17 10:12:56 +00:00
parent 8733534ad8
commit 175c401e0f
3 changed files with 73 additions and 32 deletions

View File

@@ -69,12 +69,25 @@
}
function update() {
// reset modification mode
controls.modify.mode = OpenLayers.Control.ModifyFeature.RESHAPE;
var rotate = document.getElementById("rotate").checked;
controls.modify.rotate = rotate;
if(rotate) {
controls.modify.mode |= OpenLayers.Control.ModifyFeature.ROTATE;
}
var resize = document.getElementById("resize").checked;
controls.modify.resize = resize;
if(resize) {
controls.modify.mode |= OpenLayers.Control.ModifyFeature.RESIZE;
}
var drag = document.getElementById("drag").checked;
controls.modify.drag = drag;
if(drag) {
controls.modify.mode |= OpenLayers.Control.ModifyFeature.DRAG;
}
// disable reshape mode if at least one of modes rotate, resize,
// drag is enabled
if (rotate || resize || drag) {
controls.modify.mode &= ~OpenLayers.Control.ModifyFeature.RESHAPE;
}
var sides = parseInt(document.getElementById("sides").value);
sides = Math.max(3, isNaN(sides) ? 0 : sides);
controls.regular.handler.sides = sides;