Skip to content

Commit

Permalink
issue planetfederal#216 - Text label editing: enable Text Fieldset an…
Browse files Browse the repository at this point in the history
…d fix text opacity edit
  • Loading branch information
justb4 committed Feb 3, 2014
1 parent 1cb15bb commit c749071
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/script/plugins/VectorStyleWriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ gxp.plugins.VectorStyleWriter = Ext.extend(gxp.plugins.StyleWriter, {
textStyle.fontWeight = symbolizer.fontWeight;
textStyle.fontStyle = symbolizer.fontStyle;
textStyle.fontColor = symbolizer.fontColor;
textStyle.fontOpacity = symbolizer.fontOpacity;
}
rule.symbolizer[symbolType] = rule.symbolizers[j].clone();
// newStyle.label = rule.symbolizer[symbolType].label;
}
rule.symbolizers = undefined;
}
Expand Down
13 changes: 11 additions & 2 deletions src/script/widgets/VectorStylesDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ gxp.VectorStylesDialog = Ext.extend(gxp.StylesDialog, {
*/
editRule: function () {
var rule = this.selectedRule;
// May need TextSymbolizer if here first time and feature has data attrs
if (!this.textSym && this.attributeStore && this.attributeStore.data.getCount() > 0) {
rule.symbolizers.push(this.createSymbolizer('Text', {}));
this.textSym = true;
}
var origRule = rule.clone();

var ruleDlg = new this.dialogCls({
Expand Down Expand Up @@ -165,6 +170,8 @@ gxp.VectorStylesDialog = Ext.extend(gxp.StylesDialog, {
if (textSymbolizers && textSymbolizers.length == 1) {
var textSymbolizer = textSymbolizers[0];
removeItems = textSymbolizer.items.getRange(3, 7);

// Remove all from range
for (i = 0; i < removeItems.length; i++) {
textSymbolizer.remove(removeItems[i]);
}
Expand Down Expand Up @@ -245,6 +252,7 @@ gxp.VectorStylesDialog = Ext.extend(gxp.StylesDialog, {
}
symbolizer = this.createSymbolizer(symbol, style.defaultStyle);
symbolizers = [symbolizer];

style.rules = [new OpenLayers.Rule({title: style.name, symbolizers: symbolizers})];
// style.defaultsPerSymbolizer = true;
}
Expand Down Expand Up @@ -362,11 +370,12 @@ gxp.VectorStylesDialog = Ext.extend(gxp.StylesDialog, {
listeners: {
'load': function (store) {
self.layerDescription = self.attributeStore;
// The TextSymbolizer calls load() as well, leading to loop
// The TextSymbolizer calls load() as well, leading to loop
// when we would call editRule() again...
// prevent by makin load() function empty...
// We should fix this in TextSymbolizer but there is a risk to break other stuff...
store.load = function() {};
store.load = function () {
};
callback.call(self);
},
scope: this
Expand Down

0 comments on commit c749071

Please sign in to comment.