Skip to content

Commit

Permalink
Edit/Draw text symbol : preview update on name change & debug of name…
Browse files Browse the repository at this point in the history
… edit
  • Loading branch information
jcornet committed Apr 27, 2015
1 parent 451e077 commit fe07e52
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Widget.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h2>${nls.addDrawTitle}</h2>

<label>${nls.nameField}:</label>
<br />
<input id="nameField" type="text" data-dojo-attach-point="nameField" value="${nls.nameFieldDefaultValue}" class="jimu-input" />
<input id="nameField" type="text" data-dojo-attach-point="nameField" value="${nls.nameFieldDefaultValue}" class="jimu-input" data-dojo-attach-event="onchange:_nameChanged"/>
<br />
<label>${nls.descriptionField}:</label>
<br />
Expand Down Expand Up @@ -96,7 +96,7 @@ <h2>${nls.editDrawTitle}</h2>
<div class="content">
<label>${nls.nameField}:</label>
<br />
<input id="nameField" type="text" data-dojo-attach-point="editNameField" value="${nls.nameFieldDefaultValue}" class="jimu-input" />
<input id="nameField" type="text" data-dojo-attach-point="editNameField" value="${nls.nameFieldDefaultValue}" class="jimu-input" data-dojo-attach-event="onchange:_editNameChanged" />
<br />
<label>${nls.descriptionField}:</label>
<br />
Expand Down
16 changes: 14 additions & 2 deletions Widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,7 @@ define([
html.place(this.globalViewStack.domNode, this.settingAllContent);
},




setTab:function(name){
var tab_asked = this._tabsConfig[name];

Expand Down Expand Up @@ -904,13 +903,22 @@ define([

},

_nameChanged:function(){
this._update_add_textSymbol()
},

_editNameChanged:function(){
this._update_edit_textSymbol()
},

_update_add_textSymbol:function(){
var family = this.textPlusPoliceNode.value;
var angle = this.textAngleNode.value;
var weight = this._drawPlus["add"]["bold"] ? esri.symbol.Font.WEIGHT_BOLD : esri.symbol.Font.WEIGHT_NORMAL;
var style = this._drawPlus["add"]["italic"] ? esri.symbol.Font.STYLE_ITALIC : esri.symbol.Font.STYLE_NORMAL;
var decoration = this._drawPlus["add"]["underline"] ? 'underline' : 'none';

this.textSymChooser.symbol.text = this.nameField.value;
this.textSymChooser.symbol.font.setFamily(family);
this.textSymChooser.symbol.setAngle(angle);
this.textSymChooser.symbol.font.setWeight(weight);
Expand All @@ -919,6 +927,7 @@ define([

this.drawBox.setTextSymbol(this.textSymChooser.symbol);

this.textSymChooser.textPreview.innerHTML = this.nameField.value;
this.textSymChooser.textPreview.style.fontFamily = family;
this.textSymChooser.textPreview.style['font-style'] = (this._drawPlus["add"]["italic"]) ? 'italic' : 'normal';
this.textSymChooser.textPreview.style['font-weight'] = (this._drawPlus["add"]["bold"]) ? 'bold' : 'normal';
Expand All @@ -933,6 +942,7 @@ define([
this.textAnglePreviewNode.style['-ms-transform'] = 'rotate(' + angle + 'deg)';

if(this._phantomSymbol && this._phantomSymbol.font){
this._phantomSymbol.text = this.nameField.value;
this._phantomSymbol.font.setFamily(family);
this._phantomSymbol.setAngle(angle);
this._phantomSymbol.font.setWeight(weight);
Expand All @@ -949,12 +959,14 @@ define([
var decoration = this._drawPlus["edit"]["underline"] ? 'underline' : 'none';


this._EditSymbolChooser.symbol.text = this.editNameField.value;
this._EditSymbolChooser.symbol.font.setFamily(family);
this._EditSymbolChooser.symbol.setAngle(angle);
this._EditSymbolChooser.symbol.font.setWeight(weight);
this._EditSymbolChooser.symbol.font.setStyle(style);
this._EditSymbolChooser.symbol.font.setDecoration(decoration);

this._EditSymbolChooser.textPreview.innerHTML = this.editNameField.value;
this._EditSymbolChooser.textPreview.style.fontFamily = family;
this._EditSymbolChooser.textPreview.style['font-style'] = (this._drawPlus["edit"]["italic"]) ? 'italic' : 'normal';
this._EditSymbolChooser.textPreview.style['font-weight'] = (this._drawPlus["edit"]["bold"]) ? 'bold' : 'normal';
Expand Down

0 comments on commit fe07e52

Please sign in to comment.