[Laszlo-checkins] r12029 - in openlaszlo/trunk: WEB-INF/lps/lfc/kernel/dhtml WEB-INF/lps/lfc/kernel/swf WEB-INF/lps/lfc/kernel/swf9 WEB-INF/lps/lfc/views test/text
bargull@openlaszlo.org
bargull at openlaszlo.org
Tue Dec 9 08:55:10 PST 2008
Author: bargull
Date: 2008-12-09 08:55:03 -0800 (Tue, 09 Dec 2008)
New Revision: 12029
Added:
openlaszlo/trunk/test/text/newtextformat.lzx
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as
openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs
Log:
Change 20081124-bargull-seH by bargull at dell--p4--2-53 on 2008-11-24 18:58:03
in /home/Admin/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: add implementation for text-align, text-indent, text-decoration, letter-spacing
New Features: LPP-7385
Bugs Fixed: LPP-7384
Technical Reviewer: max
QA Reviewer: promanik
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
LzText:
- convert "setMultiline()" to setter, deprecate old method
- added "textalign", "textindent", "letterspacing" and "textdecoration"
LzTextSprite (swf8):
- added "_textAlign", "_textIndent", "_letterSpacing", "_textDecoration"
- implemented setters, really straight forward
- update "__setFormat()" to reflect changes in TextFormat
- use "leftMargin" for negative textleading
- use "wordWrap" in "getTextHeight()" instead of setting "_width" to a high value
- make sure to back-up dimensions in "getTextfieldHeight()", or the textclip's width is no longer in sync with the sprite's width
(this was required for "textalign" to work!)
LzTextSprite (swf9):
- added "textalign", "textindent", "letterspacing" and "textdecoration"
- update "__setFormat()" to reflect changes in TextFormat
- use "leftMargin" for negative textleading
- implemented setters, again pretty straight forward
LzSprite (dhtml):
- added default styles
- removed "letter-spacing" adjustement for 'text_height_includes_margins'-quirk (LPP-7384)
- added some quirks for IE and Opera
LzTextSprite (dhtml):
- added "_textAlign", "_textIndent", "_letterSpacing", "_textDecoration" and "__LZtextIndent"
- updated "getTextSize()" to reflect new attributes
- updated "setWidth()" and "setHeight()" to get the same effect as Flash-TextFormat's "leftMargin"
- implemented setters for the new attributes, only needed to special case "textindent" to copy "leftMargin" behaviour from Flash
Tests:
run test/text/newtextformat.lzx should look the same in all runtimes (tested swf8, swf9, dhtml in FF3, IE6, Opera9.6)
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 2008-12-09 16:50:03 UTC (rev 12028)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 2008-12-09 16:55:03 UTC (rev 12029)
@@ -173,7 +173,11 @@
fontWeight: 'normal',
fontSize: '11px',
whiteSpace: 'normal',
- position: 'absolute'
+ position: 'absolute',
+ textAlign: 'left',
+ textIndent: '0px',
+ letterSpacing: '0px',
+ textDecoration: 'none'
},
lzswftext: {
fontFamily: 'Verdana,Vera,sans-serif',
@@ -184,7 +188,11 @@
position: 'absolute',
paddingTop: '2px',
paddingLeft: '2px',
- lineHeight: '120%'
+ lineHeight: '120%',
+ textAlign: 'left',
+ textIndent: '0px',
+ letterSpacing: '0px',
+ textDecoration: 'none'
},
lzinputtext: {
fontFamily: 'Verdana,Vera,sans-serif',
@@ -194,7 +202,11 @@
width: '100%',
height: '100%',
borderWidth: 0,
- backgroundColor: 'transparent'
+ backgroundColor: 'transparent',
+ textAlign: 'left',
+ textIndent: '0px',
+ letterSpacing: '0px',
+ textDecoration: 'none'
},
lzswfinputtext: {
fontFamily: 'Verdana,Vera,sans-serif',
@@ -207,7 +219,11 @@
backgroundColor: 'transparent',
paddingTop: '1px',
paddingLeft: '1px',
- lineHeight: '120%'
+ lineHeight: '120%',
+ textAlign: 'left',
+ textIndent: '0px',
+ letterSpacing: '0px',
+ textDecoration: 'none'
},
lzswfinputtextmultiline: {
fontFamily: 'Verdana,Vera,sans-serif',
@@ -220,7 +236,11 @@
backgroundColor: 'transparent',
paddingTop: '2px',
paddingLeft: '1px',
- lineHeight: '120%'
+ lineHeight: '120%',
+ textAlign: 'left',
+ textIndent: '0px',
+ letterSpacing: '0px',
+ textDecoration: 'none'
},
writeCSS: function() {
var css = '';
@@ -318,6 +338,8 @@
,inputtext_size_includes_margin: false
,listen_for_mouseover_out: true
,focus_on_mouseover: true
+ ,textstyle_on_textdiv: false
+ ,textdeco_on_textdiv: false
}
LzSprite.prototype.capabilities = {
@@ -415,6 +437,8 @@
quirks['inputtext_size_includes_margin'] = true;
// LPP-7229 - IE 'helpfully' scrolls focused/blurred divs into view
quirks['focus_on_mouseover'] = false;
+ // required for text-align / text-indent to work
+ quirks['textstyle_on_textdiv'] = true;
} else if (browser.isSafari) {
// Remap alt/option key also sends control since control-click shows context menu (see LPP-2584 - Lzpix: problem with multi-selecting images in Safari 2.0.4, dhtml)
quirks['alt_key_sends_control'] = true;
@@ -459,6 +483,7 @@
quirks['document_size_use_offsetheight'] = true;
// Opera does not use charCode for onkeypress
quirks['text_event_charcode'] = false;
+ quirks['textdeco_on_textdiv'] = true;
} else if (browser.isFirefox) {
if (browser.version < 2) {
// see http://groups.google.ca/group/netscape.public.mozilla.dom/browse_thread/thread/821271ca11a1bdbf/46c87b49c026246f?lnk=st&q=+focus+nsIAutoCompletePopup+selectedIndex&rnum=1
@@ -482,10 +507,7 @@
}
if (this.quirks['text_height_includes_margins']) {
LzSprite.prototype.__defaultStyles.lzswfinputtext.paddingTop = '0px';
- LzSprite.prototype.__defaultStyles.lzswfinputtext.letterSpacing = '.2px';
LzSprite.prototype.__defaultStyles.lzswfinputtextmultiline.paddingTop = '0px';
- LzSprite.prototype.__defaultStyles.lzswfinputtextmultiline.letterSpacing = '.2px';
- LzSprite.prototype.__defaultStyles.lzswftext.letterSpacing = '.2px';
}
if (quirks['inputtext_size_includes_margin']) {
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js 2008-12-09 16:50:03 UTC (rev 12028)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js 2008-12-09 16:55:03 UTC (rev 12029)
@@ -55,6 +55,11 @@
LzTextSprite.prototype._fontSize = '11px';
LzTextSprite.prototype._fontFamily = 'Verdana,Vera,sans-serif';
LzTextSprite.prototype._whiteSpace = 'normal';
+LzTextSprite.prototype._textAlign = 'left';
+LzTextSprite.prototype._textIndent = '0px';
+LzTextSprite.prototype.__LZtextIndent = 0;
+LzTextSprite.prototype._letterSpacing = '0px';
+LzTextSprite.prototype._textDecoration = 'none';
LzTextSprite.prototype.__wpadding = 4;
LzTextSprite.prototype.__hpadding = 4;
LzTextSprite.prototype.__sizecacheupperbound = 1000;
@@ -251,12 +256,16 @@
style += ';font-weight: ' + this._fontWeight;
style += ';font-family: ' + this._fontFamily;
style += ';line-height: ' + LzSprite.prototype.__defaultStyles.lzswftext.lineHeight;
- if (this.quirks['text_height_includes_margins']) {
- style += ';letter-spacing: .2px';
- }
+ style += ';letter-spacing: ' + this._letterSpacing;
+ style += ';text-indent: ' + this._textIndent;
+ style += ';text-align: ' + this._textAlign;
if (this.multiline && ignorewidth != true) {
- if (this.width) style += ';width: ' + this.width + 'px';
+ var w = this.width;
+ if (w) {
+ if (this.__LZtextIndent < 0) w += this.__LZtextIndent;
+ style += ';width: ' + w + 'px';
+ }
}
style += ';white-space: ' + this._whiteSpace;
@@ -420,11 +429,16 @@
}
LzTextSprite.prototype.__setWidth = LzSprite.prototype.setWidth;
-LzTextSprite.prototype.setWidth = function (w){
- if (w == null || w < 0 || isNaN(w) || this.width == w) return;
- var wp = this.CSSDimension(w >= this.__wpadding ? w - this.__wpadding : 0);
- this.__LZtextdiv.style.width = wp;
- this.__LZtextdiv.style.clip = 'rect(0px ' + wp + ' ' + this.CSSDimension(this.height >= this.__hpadding ? this.height - this.__hpadding : 0) + ' 0px)';
+LzTextSprite.prototype.setWidth = function (w, force){
+ if (w == null || w < 0 || isNaN(w) || (this.width == w && !force)) return;
+ var wt = (w >= - this.__wpadding ? w - this.__wpadding : 0);
+ // need to substract (negative) text-indent from width (but not from clip!),
+ // because we've added a left-padding in setTextAlign()
+ var wtInd = (this.__LZtextIndent < 0 ? -1*this.__LZtextIndent : 0);
+ this.__LZtextdiv.style.width = this.CSSDimension(wt >= wtInd ? wt - wtInd : 0);
+ var wp = this.CSSDimension(wt);
+ var hp = this.CSSDimension(this.height >= this.__hpadding ? this.height - this.__hpadding : 0);
+ this.__LZtextdiv.style.clip = 'rect(0px ' + wp + ' ' + hp + ' 0px)';
this.__setWidth(w);
this._styledirty = true;
}
@@ -432,9 +446,10 @@
LzTextSprite.prototype.__setHeight = LzSprite.prototype.setHeight;
LzTextSprite.prototype.setHeight = function (h){
if (h == null || h < 0 || isNaN(h) || this.height == h) return;
+ var wp = this.CSSDimension(this.width >= this.__wpadding ? this.width - this.__wpadding : 0);
var hp = this.CSSDimension(h >= this.__hpadding ? h - this.__hpadding : 0);
this.__LZtextdiv.style.height = hp;
- this.__LZtextdiv.style.clip = 'rect(0px ' + this.CSSDimension(this.width >= this.__wpadding ? this.width - this.__wpadding : 0) + ' ' + hp + ' 0px)';
+ this.__LZtextdiv.style.clip = 'rect(0px ' + wp + ' ' + hp + ' 0px)';
this.__setHeight(h);
if (this.multiline) this._styledirty = true;
}
@@ -482,4 +497,59 @@
LzTextSprite.deleteLinkID(this.owner.getUID());
this._viewdestroy( );
}
-
+
+LzTextSprite.prototype.setTextAlign = function (align) {
+ if (this._textAlign != align) {
+ this._textAlign = align;
+ if (this.quirks.textstyle_on_textdiv) {
+ this.__LZtextdiv.style.textAlign = align;
+ } else {
+ this.__LZdiv.style.textAlign = align;
+ }
+ this._styledirty = true;
+ }
+}
+
+LzTextSprite.prototype.setTextIndent = function (indent) {
+ // In standard-compliance mode, all dimensions must have units
+ var indentPx = this.CSSDimension(indent);
+ if (this._textIndent != indentPx) {
+ var negInd = (indent < 0) || (this.__LZtextIndent < 0);
+ this._textIndent = indentPx;
+ this.__LZtextIndent = indent;
+ if (this.quirks.textstyle_on_textdiv) {
+ this.__LZtextdiv.style.textIndent = indentPx;
+ } else {
+ this.__LZdiv.style.textIndent = indentPx;
+ }
+ this._styledirty = true;
+ if (negInd) {
+ // only add padding for negative indent, but remove minus sign
+ this.__LZtextdiv.style.paddingLeft = (indent >= 0) ? "" : indentPx.substr(1);
+ // reset width
+ this.setWidth(this.width, true);
+ }
+ }
+}
+
+LzTextSprite.prototype.setLetterSpacing = function (spacing) {
+ // In standard-compliance mode, all dimensions must have units
+ spacing = this.CSSDimension(spacing);
+ if (this._letterSpacing != spacing) {
+ this._letterSpacing = spacing;
+ this.__LZdiv.style.letterSpacing = spacing;
+ this._styledirty = true;
+ }
+}
+
+LzTextSprite.prototype.setTextDecoration = function (decoration) {
+ if (this._textDecoration != decoration) {
+ this._textDecoration = decoration;
+ if (this.quirks.textdeco_on_textdiv) {
+ this.__LZtextdiv.style.textDecoration = decoration;
+ } else {
+ this.__LZdiv.style.textDecoration = decoration;
+ }
+ // note: don't need to mark style as dirty here
+ }
+}
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as 2008-12-09 16:50:03 UTC (rev 12028)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as 2008-12-09 16:55:03 UTC (rev 12029)
@@ -170,7 +170,6 @@
*/
LzTextSprite.prototype.maxhscroll = 0;
-
// [todo: 2004-3-29 hqm] lines seem to get the ends clipped off if you use the TextField.textWidth
// from Flash, so I am adding a constant. Am I missing something here?
LzTextSprite.prototype.PAD_TEXTWIDTH = 4;
@@ -180,6 +179,23 @@
LzTextSprite.prototype.DEFAULT_SIZE = 8;
/**
+ * @access private
+ */
+LzTextSprite.prototype._textAlign = "left";
+/**
+ * @access private
+ */
+LzTextSprite.prototype._textIndent = 0;
+/**
+ * @access private
+ */
+LzTextSprite.prototype._letterSpacing = 0;
+/**
+ * @access private
+ */
+LzTextSprite.prototype._textDecoration = "none";
+
+/**
* setResize set behavior of text field width when new text is added.
* LzTextSprite only (cannot be used with LzInputText).
* @param Boolean val: if true, the textfield will recompute it's width after setText() is called
@@ -263,8 +279,11 @@
LzTextSprite.prototype.getTextfieldHeight = function ( ){
var textclip = this.__LZtextclip;
+ var tca = textclip.autoSize;
+ var tcw = textclip._width;
+ var tch = textclip._height;
+
// turn on autoSize temporarily
- var tca = textclip.autoSize;
textclip.autoSize = true;
// measure height and reset to the original values
var h = textclip._height;
@@ -276,8 +295,10 @@
var h = textclip._height;
textclip.htmlText = tct;
}
-
+
textclip.autoSize = tca;
+ textclip._height = tch;
+ textclip._width = tcw;
return h;
}
@@ -301,13 +322,15 @@
var tch = textclip._height;
var tca = textclip.autoSize;
var tct = textclip.htmlText;
+ var tcp = textclip.wordWrap;
textclip.autoSize = true;
// Make sure the test text does not wrap!
- textclip._width = 500;
+ textclip.wordWrap = false;
textclip.htmlText = "__ypgSAMPLE__";
var h = textclip.textHeight;
+ textclip.wordWrap = tcp;
textclip.autoSize = tca;
textclip.htmlText = tct;
textclip._width = tcw;
@@ -617,7 +640,15 @@
// Adjust style
tf.bold = (this.fontstyle == "bold" || this.fontstyle =="bolditalic");
tf.italic = (this.fontstyle == "italic" || this.fontstyle =="bolditalic");
- tf.underline = !!this['underline'];
+ tf.underline = !!this['underline'] || this._textDecoration == "underline";
+ tf.align = this._textAlign;
+ tf.indent = this._textIndent;
+ if (this._textIndent < 0) {
+ tf.leftMargin = this._textIndent * -1;
+ } else {
+ tf.leftMargin = 0;
+ }
+ tf.letterSpacing = this._letterSpacing;
// We want to adjust the current contents, _and_ any new contents.
this.__LZtextclip.setNewTextFormat(tf);
@@ -946,3 +977,32 @@
this._viewdestroy( );
}
+LzTextSprite.prototype.setTextAlign = function (align) {
+ this._textAlign = align;
+ this.__setFormat();
+ // recompute dimensions: must use clip html here -- inputtext may
+ // have modified the contents
+ this.setText( this.getText() );
+}
+
+LzTextSprite.prototype.setTextIndent = function (indent) {
+ this._textIndent = indent;
+ this.__setFormat();
+ // recompute dimensions: must use clip html here -- inputtext may
+ // have modified the contents
+ this.setText( this.getText() );
+}
+
+LzTextSprite.prototype.setLetterSpacing = function (spacing) {
+ this._letterSpacing = spacing;
+ this.__setFormat();
+ // recompute dimensions: must use clip html here -- inputtext may
+ // have modified the contents
+ this.setText( this.getText() );
+}
+
+LzTextSprite.prototype.setTextDecoration = function (decoration) {
+ this._textDecoration = decoration;
+ this.__setFormat();
+ // note: don't need to recompute dimensions here
+}
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as 2008-12-09 16:50:03 UTC (rev 12028)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as 2008-12-09 16:55:03 UTC (rev 12029)
@@ -39,6 +39,11 @@
public var multiline:Boolean = false;
public var underline:Boolean = false;
+ public var textalign:String = "left";
+ public var textindent:Number = 0;
+ public var letterspacing:Number = 0;
+ public var textdecoration:String = "none";
+
public var sizeToHeight:Boolean = false;
public var password:Boolean = false;
public var scrollheight:Number = 0;
@@ -280,8 +285,6 @@
}
}
-
-
public function appendText( t:String ):void {
this.textfield.appendText(t);
this.text = this.textfield.text;
@@ -310,7 +313,7 @@
t = t.toString();
}
- this.text = t;
+ this.text = t;
this.textfield.htmlText = t;
if (this.resize && (this.multiline == false)) {
@@ -346,7 +349,6 @@
* @access private
*/
public function __setFormat ():void {
-
this.setFontInfo();
var cfontname = LzFontManager.__fontnameCacheMap[this.fontname];
if (cfontname == null) {
@@ -364,25 +366,21 @@
tf.color = this.textcolor;
// If there is no font found, assume a device font
- if (this.font == null) {
- this.textfield.embedFonts = false;
+ this.textfield.embedFonts = (this.font != null);
+
+ tf.bold = (this.fontstyle == "bold" || this.fontstyle =="bolditalic");
+ tf.italic = (this.fontstyle == "italic" || this.fontstyle =="bolditalic");
+ tf.underline = (this.underline || this.textdecoration == "underline");
+ tf.align = this.textalign;
+ tf.indent = this.textindent;
+ if (this.textindent < 0) {
+ tf.leftMargin = this.textindent * -1;
} else {
- this.textfield.embedFonts = true;
+ tf.leftMargin = 0;
}
+ tf.letterSpacing = this.letterspacing;
- if (this.fontstyle == "bold" || this.fontstyle =="bolditalic"){
- tf.bold = true;
- }
-
- if (this.fontstyle == "italic" || this.fontstyle =="bolditalic"){
- tf.italic = true;
- }
- if (this.underline){
- tf.underline = true;
- }
-
this.textfield.defaultTextFormat = tf;
-
}
@@ -391,11 +389,9 @@
if (this.multiline) {
this.textfield.multiline = true;
this.textfield.wordWrap = true;
-
} else {
this.textfield.multiline = false;
this.textfield.wordWrap = false;
-
}
}
@@ -410,12 +406,12 @@
}
public function getTextWidth ( ):Number {
- var tf:TextField = this.textfield;
- var ml:Boolean = tf.multiline;
- var mw:Boolean = tf.wordWrap;
+ var tf:TextField = this.textfield;
+ var ml:Boolean = tf.multiline;
+ var mw:Boolean = tf.wordWrap;
tf.multiline = false;
tf.wordWrap = false;
- var twidth:Number = (tf.textWidth == 0) ? 0 : tf.textWidth + LzTextSprite.PAD_TEXTWIDTH;
+ var twidth:Number = (tf.textWidth == 0) ? 0 : tf.textWidth + LzTextSprite.PAD_TEXTWIDTH;
tf.multiline = ml;
tf.wordWrap = mw;
return twidth;
@@ -425,14 +421,11 @@
return this.textfield.textHeight;
}
-
-
public function getTextfieldHeight ( ) {
return this.textfield.height;
}
-
function setHScroll(s:Number) {
this.textfield.scrollH = s;
}
@@ -518,6 +511,33 @@
return this.textfield.selectionEndIndex - this.textfield.selectionBeginIndex;
}
+ function setTextAlign (align:String) :void {
+ this.textalign = align;
+ this.__setFormat();
+ // force recompute of height if needed
+ this.setText( this.text );
+ }
+
+ function setTextIndent (indent:Number) :void {
+ this.textindent = indent;
+ this.__setFormat();
+ // force recompute of height if needed
+ this.setText( this.text );
+ }
+
+ function setLetterSpacing (spacing:Number) :void {
+ this.letterspacing = spacing;
+ this.__setFormat();
+ // force recompute of height if needed
+ this.setText( this.text );
+ }
+
+ function setTextDecoration (decoration:String) :void {
+ this.textdecoration = decoration;
+ this.__setFormat();
+ // note: don't need to recompute height
+ }
+
}#
}
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs 2008-12-09 16:50:03 UTC (rev 12028)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs 2008-12-09 16:55:03 UTC (rev 12029)
@@ -449,24 +449,24 @@
super.construct.apply(this, arguments);
this.sizeToHeight = false;
-
+
// Install constant/default font attributes
for (var arg:String in LzText.fontArgToAttr) {
var attr:String = LzText.fontArgToAttr[arg];
// Default missing args
if (! (arg in args)) {
args[arg] = this.searchParents(attr)[attr];
- }
+ }
this[attr] = args[arg];
}
-
- var tsprite:LzTextSprite = (this.sprite cast LzTextSprite);
+
+ var tsprite:LzTextSprite = (this.sprite cast LzTextSprite);
// FIXME [2008-11-24 ptw] (LPP-7391) We should not be passing node
// init args across the kernel API, there should be a more
// explicit API that isolates the kernel from the node
// implementation details
tsprite.__initTextProperties(args);
-
+
// Remove constant/default font attributes, so they won't be
// re-handled by LzNode/__LZapplyArgs
for (var arg:String in LzText.fontArgToAttr) {
@@ -488,7 +488,7 @@
this.text = this.text.substring(0, this.maxlength);
}
- this.setMultiline( this.multiline );
+ this.$lzc$set_multiline( this.multiline );
tsprite.setText( this.text );
@@ -521,7 +521,7 @@
// if single line, use font line height
// else get height from flash textobject.textHeight
//
- if (! this.hassetheight) {
+ if (!this.hassetheight) {
this.sizeToHeight = true;
} else if (args['height'] != null) {
this.$lzc$set_height(args.height);
@@ -564,12 +564,7 @@
return tsprite.getMCRef();
}
-/**
- * @access private
- */
-var $lzc$set_multiline = -1;
-
/**
* Maximum number of characters allowed in this field
* @lzxtype numberExpression
@@ -1038,17 +1033,25 @@
this.$lzc$set_fontstyle(fstyle);
}
+/**
+ * @access private
+ */
+function $lzc$set_multiline(ml) :void {
+ var tsprite:LzTextSprite = (this.sprite cast LzTextSprite);
+ tsprite.setMultiline(ml);
+ this.multiline = (ml == true);
+}
/**
* Sets whether or not the textfield wraps. If false, only a single line
* of text will appear and extra lines will be trucated if the text is set with
* multiple lines.
* @param Boolean ml: true if the text field should allow multiple lines
+ * @deprecated Use setAttribute('multiline', ...) instead.
*/
-function setMultiline ( ml ){
- var tsprite:LzTextSprite = (this.sprite cast LzTextSprite);
- tsprite.setMultiline(ml);
- this.multiline = (ml == true);
+final function setMultiline ( ml ){
+ if ($debug) Debug.deprecated(this, arguments.callee, this.setAttribute);
+ this.$lzc$set_multiline(ml);
}
@@ -1237,6 +1240,81 @@
return (this.sprite cast LzTextSprite).makeTextLink(str,value);
}
+
+/** text-align for this text
+ * @lzxtype string
+ * @type String
+ */
+var textalign :String = "left";
+
+/** text-indent for this text
+ * @lzxtype number
+ * @type Number
+ */
+var textindent :Number = 0;
+
+/** letter-spacing for this text
+ * @lzxtype number
+ * @type Number
+ */
+var letterspacing :Number = 0;
+
+/** text-decoration for this text
+ * @lzxtype string
+ * @type String
+ */
+var textdecoration :String = "none";
+
+/** @access private */
+function $lzc$set_textalign (align:String) :void {
+ align = align ? align.toLowerCase() : "left";
+ if (! (align == "left" || align == "right" || align == "center"
+ || align == "justify")) {
+ if ($debug) {
+ Debug.warn("invalid value for %w.textalign = %w", this, align);
+ }
+ align = "left";
+ }
+ this.textalign = align;
+ (this.sprite cast LzTextSprite).setTextAlign(align);
+ // force recompute of height if needed
+ this._textrecompute = true;
+ this.$lzc$set_text(this.getText());
+}
+
+/** @access private */
+function $lzc$set_textindent (indent:Number) :void {
+ this.textindent = indent;
+ (this.sprite cast LzTextSprite).setTextIndent(indent);
+ // force recompute of height if needed
+ this._textrecompute = true;
+ this.$lzc$set_text(this.getText());
+}
+
+/** @access private */
+function $lzc$set_letterspacing (spacing:Number) :void {
+ this.letterspacing = spacing;
+ (this.sprite cast LzTextSprite).setLetterSpacing(spacing);
+ // force recompute of height if needed
+ this._textrecompute = true;
+ this.$lzc$set_text(this.getText());
+}
+
+/** @access private */
+function $lzc$set_textdecoration (decoration:String) :void {
+ decoration = decoration ? decoration.toLowerCase() : "none";
+ if (! (decoration == "none" || decoration == "underline")) {
+ // CSS actually also allows: overline, line-through, blink
+ // but Flash can't handle that..
+ if ($debug) {
+ Debug.warn("invalid value for %w.textdecoration = %w", this, decoration);
+ }
+ decoration = "none";
+ }
+ this.textdecoration = decoration;
+ (this.sprite cast LzTextSprite).setTextDecoration(decoration);
+}
+
} // End of LzText
lz[LzText.tagname] = LzText; // publish
Added: openlaszlo/trunk/test/text/newtextformat.lzx
Property changes on: openlaszlo/trunk/test/text/newtextformat.lzx
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
More information about the Laszlo-checkins
mailing list