Adding the ability to change the aspect ratio of features while resizing with the modify feature control. Thanks for the patch rdewit! r=me (closes #1975)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@9150 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2009-03-31 21:36:11 +00:00
parent ef23accd13
commit 2ab6c404e1
3 changed files with 38 additions and 13 deletions

View File

@@ -70,14 +70,16 @@
var resize = document.getElementById("resize").checked;
if(resize) {
controls.modify.mode |= OpenLayers.Control.ModifyFeature.RESIZE;
var keepAspectRatio = document.getElementById("keepAspectRatio").checked;
if (keepAspectRatio) {
controls.modify.mode &= ~OpenLayers.Control.ModifyFeature.RESHAPE;
}
}
var drag = document.getElementById("drag").checked;
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) {
if (rotate || drag) {
controls.modify.mode &= ~OpenLayers.Control.ModifyFeature.RESHAPE;
}
var sides = parseInt(document.getElementById("sides").value);
@@ -151,6 +153,9 @@
<input id="resize" type="checkbox"
name="resize" onchange="update()" />
<label for="resize">allow resizing</label>
(<input id="keepAspectRatio" type="checkbox"
name="keepAspectRatio" onchange="update()" checked="checked" />
<label for="keepAspectRatio">keep aspect ratio</label>)
</li>
<li>
<input id="drag" type="checkbox"