[Commits] r1759 - in sandbox/redlining/ux/FeatureEditing/ux/widgets: . form
commits at geoext.org
commits at geoext.org
Fri Jan 15 21:32:22 CET 2010
Author: adube
Date: 2010-01-15 21:32:22 +0100 (Fri, 15 Jan 2010)
New Revision: 1759
Modified:
sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js
sandbox/redlining/ux/FeatureEditing/ux/widgets/form/RedLiningPanel.js
Log:
auto-opacity full support (but with stylemap, for now)
Modified: sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js 2010-01-15 20:03:26 UTC (rev 1758)
+++ sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js 2010-01-15 20:32:22 UTC (rev 1759)
@@ -425,14 +425,14 @@
var feature = (event.geometry) ? event : event.feature;
// or we could execute commits here also
- if(this.lastDrawControl) {
+ if(this.lastDrawControl && feature.layer.selectedFeatures.length != 0) {
this.featureControl.deactivate();
this.lastDrawControl.activate();
this.lastDrawControl = null;
}
},
- /** private: method[onModificationEnd]
+ /** private: method[onFeatureUnselect]
* :param event: ``event``
* Close the popup linked to a feature if any.
*/
Modified: sandbox/redlining/ux/FeatureEditing/ux/widgets/form/RedLiningPanel.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/widgets/form/RedLiningPanel.js 2010-01-15 20:03:26 UTC (rev 1758)
+++ sandbox/redlining/ux/FeatureEditing/ux/widgets/form/RedLiningPanel.js 2010-01-15 20:32:22 UTC (rev 1759)
@@ -127,8 +127,10 @@
);
this.styleMap = new OpenLayers.StyleMap({
- "default": fadedStyle,
- "select": style
+ "default": style,
+ "select": style,
+ "normal": style,
+ "faded": fadedStyle
});
layer = new OpenLayers.Layer.Vector(
@@ -140,6 +142,8 @@
layer.events.on({
"beforefeatureadded": this.onBeforeFeatureAdded,
+ "beforefeatureselected": this.onBeforeFeatureSelect,
+ "featureunselected": this.onFeatureUnselect,
scope: this
});
},
@@ -165,8 +169,47 @@
feature.attributes[this.attributes[i]] = '';
}
}
- }
-
+ },
+
+ /** private: method[onFeatureSelect]
+ * :param event: ``event``
+ * Called when a feature is selected
+ */
+ onBeforeFeatureSelect: function(event) {
+ var feature = (event.geometry) ? event : event.feature;
+
+ // if it's the first feature that is selected
+ if(feature.layer.selectedFeatures.length == 0) {
+ this.applyFadedStyle(feature.layer);
+ }
+ },
+
+ /** private: method[onFeatureUnselect]
+ * :param event: ``event``
+ * Called when a feature is unselected.
+ */
+ onFeatureUnselect: function(event) {
+ var feature = (event.geometry) ? event : event.feature;
+
+ // if it's the last feature that is unselected
+ if(feature.layer.selectedFeatures.length == 0) {
+ this.applyNormalStyle(feature.layer);
+ }
+ },
+
+ applyNormalStyle: function(layer) {
+ styles = layer.styleMap.styles;
+ styles['default'] = styles['normal'];
+
+ layer.redraw();
+ },
+
+ applyFadedStyle: function(layer) {
+ styles = layer.styleMap.styles;
+ styles['default'] = styles['faded'];
+
+ layer.redraw();
+ },
});
/** api: xtype = gx_featureform */
More information about the Commits
mailing list