diff --git a/examples/transform-feature.html b/examples/transform-feature.html
index d768c106a6..cfb1407b62 100644
--- a/examples/transform-feature.html
+++ b/examples/transform-feature.html
@@ -14,29 +14,14 @@
function init(){
map = new OpenLayers.Map('map', {allOverlays: true});
- // context for appropriate scale/resize cursors
- var cursors = ["sw-resize", "s-resize", "se-resize",
- "e-resize", "ne-resize", "n-resize", "nw-resize", "w-resize"];
- var context = {
- getCursor: function(feature){
- var i = OpenLayers.Util.indexOf(control.handles, feature);
- var cursor = "inherit";
- if(i !== -1) {
- i = (i + 8 + Math.round(control.rotation / 90) * 2) % 8;
- cursor = cursors[i];
- }
- return cursor;
- }
- };
-
// a nice style for the transformation box
var style = new OpenLayers.Style({
- cursor: "${getCursor}",
+ cursor: "${role}",
pointRadius: 5,
fillColor: "white",
fillOpacity: 1,
strokeColor: "black"
- }, {context: context});
+ });
// allow testing of specific renderers via "?renderer=Canvas", etc
var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
diff --git a/lib/OpenLayers/Control/TransformFeature.js b/lib/OpenLayers/Control/TransformFeature.js
index e0fa7c3b5a..09cc76a8a9 100644
--- a/lib/OpenLayers/Control/TransformFeature.js
+++ b/lib/OpenLayers/Control/TransformFeature.js
@@ -232,9 +232,6 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {
this.dragControl.deactivate();
deactivated = true;
}
- if (deactivated) {
- this.unsetFeature();
- }
return deactivated;
},
@@ -335,7 +332,7 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {
var control = this;
this.center = new OpenLayers.Geometry.Point(0, 0);
- var box = new OpenLayers.Feature.Vector(
+ this.box = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.LineString([
new OpenLayers.Geometry.Point(-1, -1),
new OpenLayers.Geometry.Point(0, -1),
@@ -351,7 +348,7 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {
);
// Override for box move - make sure that the center gets updated
- box.geometry.move = function(x, y) {
+ this.box.geometry.move = function(x, y) {
control._moving = true;
OpenLayers.Geometry.LineString.prototype.move.apply(this, arguments);
control.center.move(x, y);
@@ -468,10 +465,13 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {
var handles = new Array(8);
var rotationHandles = new Array(4);
var geom, handle, rotationHandle;
+ var resize = ["sw-resize", "s-resize", "se-resize", "e-resize",
+ "ne-resize", "n-resize", "nw-resize", "w-resize"];
for(var i=0; i<8; ++i) {
- geom = box.geometry.components[i];
- handle = new OpenLayers.Feature.Vector(geom.clone(), null,
- typeof this.renderIntent == "string" ? null :
+ geom = this.box.geometry.components[i];
+ handle = new OpenLayers.Feature.Vector(geom.clone(), {
+ role: resize[i]
+ }, typeof this.renderIntent == "string" ? null :
this.renderIntent);
if(i % 2 == 0) {
rotationHandle = new OpenLayers.Feature.Vector(geom.clone(),
@@ -489,7 +489,6 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {
handles[i] = handle;
}
- this.box = box;
this.rotationHandles = rotationHandles;
this.handles = handles;
},
@@ -600,10 +599,16 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {
geom._rotationHandle && geom._rotationHandle.destroy();
geom._rotationHandle = null;
}
+ this.center = null;
+ this.feature = null;
+ this.handles = null;
+ this.rotationHandleSymbolizer = null;
+ this.rotationHandles = null;
this.box.destroy();
this.box = null;
this.layer = null;
this.dragControl.destroy();
+ this.dragControl = null;
OpenLayers.Control.prototype.destroy.apply(this, arguments);
},