Author: max
Date: 2007-08-30 14:50:19 -0700 (Thu, 30 Aug 2007)
New Revision: 6292
Modified:
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/LzUtils.lzs
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LzText.lzs
Log:
Change 20070828-maxcarlson-h by [EMAIL PROTECTED] on 2007-08-28 12:11:18 PDT
in /Users/maxcarlson/openlaszlo/wafflecone
for http://svn.openlaszlo.org/openlaszlo/branches/wafflecone
Summary: Fix text measurement in swf
New Features:
Bugs Fixed: LPP-4571 - Text component not sized correctly when fontsize
configured via a constraint
Technical Reviewer: promanik
QA Reviewer: jcrowley
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details: LzTextSprite.as - Clean out unneeded defaultattrs, DeclareEvent calls
and other cruft. Set textclip.autoSize back to this.resize in
getTextfieldHeight().
LzUtils.lzs - Simplify dectohex(), make padding argument optional.
LzText.lzs - Add onhscroll and onmaxhscroll events which may be sent by swf
text sprites.
Tests: ant lztest,
http://localhost:8080/wafflecone/test/lztest/lztest-textheight.lzx?debug=true
and the following test all pass in swf and dhtml:
<canvas>
<text>Hello Laszlo! This is a really long string that should have the
correct width in flash.</text>
</canvas>
Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/LzUtils.lzs
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/LzUtils.lzs
2007-08-30 21:00:06 UTC (rev 6291)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/LzUtils.lzs
2007-08-30 21:50:19 UTC (rev 6292)
@@ -55,13 +55,11 @@
}
}
}
- ,dectohex: function(c, pad) {
+ ,dectohex: function(c, p) {
if (typeof c == 'number') {
// convert from decimal to hex
- var hD="0123456789ABCDEF";
- var hex = hD.substr(c&15,1);
- while(c>15) {c>>=4;hex=hD.substr(c&15,1)+hex;}
- var pad = pad - hex.length;
+ var hex = c.toString(16);
+ var pad = (p ? p : 0) - hex.length;
while (pad > 0) {
hex = '0' + hex;
pad--;
Modified:
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as
2007-08-30 21:00:06 UTC (rev 6291)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as
2007-08-30 21:50:19 UTC (rev 6292)
@@ -55,20 +55,8 @@
LzTextSprite.prototype = new LzSprite(null);
-LzTextSprite.prototype.defaultattrs = {};
-
-LzTextSprite.prototype.defaultattrs.pixellock = true;
-
LzTextSprite.prototype.colorstring = "#000000"; // black
-DeclareEvent(LzTextSprite.prototype, 'onmaxlength' );
-DeclareEvent(LzTextSprite.prototype, 'onpattern' );
-DeclareEvent(LzTextSprite.prototype, 'ontext' );
-DeclareEvent(LzTextSprite.prototype, 'onscroll' );
-DeclareEvent(LzTextSprite.prototype, 'onmaxscroll' );
-DeclareEvent(LzTextSprite.prototype, 'onxscroll' );
-
-
LzTextSprite.prototype.__initTextProperties = function (args) {
this.password = args.password ? true : false;
var textclip = this.__LZtextclip;
@@ -184,9 +172,6 @@
LzTextSprite.prototype.DEFAULT_SIZE = 8;
-LzTextSprite.prototype.defaultattrs.clip = true;
-
-
/**
* setResize set behavior of text field width when new text is added.
* LzTextSprite only (cannot be used with LzInputText).
@@ -218,26 +203,11 @@
this.__LZtextclip._height = val;
this._viewsetHeight( val );
}
-
LzTextSprite.prototype._viewsetHeight = LzSprite.prototype.setHeight;
-
/**
* @access private
- */
-/*
-LzTextSprite.prototype.updateMaxLines = function (){
-
- var newlin = Math.floor( this.height / ( this.font.height -1 ) );
- if ( newlin != this.maxlines ){
- this.maxlines = newlin;
- }
-}
-*/
-
-/**
- * @access private
* Set the maximum number of chars a textfield can contain
*/
LzTextSprite.prototype.setMaxLength = function ( val ){
@@ -293,35 +263,14 @@
var h = textclip._height;
textclip.htmlText = this.format + this.text + this.closeformat;
- textclip.autoSize = false;
+ textclip.autoSize = this.resize;
}
return h;
}
-
/**
* @access private
*/
-LzTextSprite.prototype.applyData = function ( d ){
- if ( null == d ){
- this.clearText();
- } else {
- this.setText( d );
- }
-}
-
-/**
- * @access private
- */
-LzTextSprite.prototype.toString = function ( ){
- return "LzTextSprite: " + this.text;
-}
-
-
-
-/**
- * @access private
- */
LzTextSprite.prototype.setScroll = function ( h ){
this.__LZtextclip.scroll = h;
}
@@ -406,8 +355,6 @@
}
}
-LzTextSprite.prototype.defaultattrs.selectable = false;
-
/**
* @access private
*/
@@ -572,58 +519,8 @@
}
}
-/**
- * @access private
- */
-LzTextSprite.prototype.getTextWidth.dependencies = function ( who , self){
- return [ self , "text" ];
-}
/**
- * @access private
- */
-
-LzTextSprite.prototype.getTextHeight.dependencies = function ( who , self){
- return [ self , "text" ];
-}
-
-/**
- * @access private
- */
-LzTextSprite.prototype.getMaxScroll.dependencies = function ( who , self){
- return [ self , "maxscroll" ];
-}
-
-
-LzTextSprite.prototype.escapeChars = { };
-LzTextSprite.prototype.escapeChars[ '>' ] = '>';
-LzTextSprite.prototype.escapeChars[ '<' ] = '<';
-
-/**
- * Returns an escaped version of the string if called with no args. If called
- * with a string argument, returns an escaped version of that string (escaped
- * here means markup-escaped, hot http escaped.)
- * @param String ts: text string to escape
- */
-LzTextSprite.prototype.escapeText = function( ts ){
-
- var t = ts == null ? this.text : ts;
-
- var i;
- for ( var ec in this.escapeChars ){
-
- while( t.indexOf( ec ) > -1 ){
- i = t.indexOf( ec );
- t = t.substring( 0 , i ) + this.escapeChars[ ec ] +
- t.substring( i+1 );
- }
- }
-
- return t;
-
-}
-
-/**
* Sets the selectability (with Ibeam cursor) of the text field
* @param Boolean isSel: true if the text may be selected by the user
*/
@@ -947,8 +844,3 @@
var siz = Selection.getEndIndex() - Selection.getBeginIndex();
return siz;
}
-
-
-LzTextSprite.prototype.toString = function () {
- return 'LzTextSprite for ' + this.owner;
-}
Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LzText.lzs
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LzText.lzs
2007-08-30 21:00:06 UTC (rev 6291)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LzText.lzs
2007-08-30 21:50:19 UTC (rev 6292)
@@ -84,6 +84,8 @@
DeclareEvent(prototype, 'onpattern');
DeclareEvent(prototype, 'onscroll');
DeclareEvent(prototype, 'onmaxscroll');
+DeclareEvent(prototype, 'onhscroll');
+DeclareEvent(prototype, 'onmaxhscroll');
/**
* @access private
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins