[Laszlo-checkins] r13623 - in openlaszlo/trunk/WEB-INF/lps/lfc/kernel: swf swf9
hqm@openlaszlo.org
hqm at openlaszlo.org
Tue Apr 7 08:20:51 PDT 2009
Author: hqm
Date: 2009-04-07 08:20:49 -0700 (Tue, 07 Apr 2009)
New Revision: 13623
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
Log:
Change 20090407-hqm-h by hqm at badtzmaru.home on 2009-04-07 09:12:54 EDT
in /Users/hqm/openlaszlo/trunk7
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: width="0" no longer makes image invisible
New Features:
Bugs Fixed: LPP-7936
Technical Reviewer: ptw
QA Reviewer: max
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
+ swf9, make sure to set scaleX,scaleY to zero if there is a width
specified, even if it's zero. The "if" clause was getting faked out
because "if (lzwidth && ...)" evals to false if lzwidth == 0.
+ swf8, allow the sprite's movieclip _xscale to go to zero, so a
resource can become invisible.
But needed to add a special case to measure resource width and height
when _xscale == 0, in updateResourceSize(), due to calculating it from
the sprite movieclip's _width and _xscale
Tests:
+ test case from bug report, resource should be invisible (swf8, swf9)
+ test case from LPP-6656 still works; stretched resource in resizelayout visible and proper width (swf8, swf9)
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as 2009-04-07 13:55:14 UTC (rev 13622)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as 2009-04-07 15:20:49 UTC (rev 13623)
@@ -599,10 +599,10 @@
// <scale as fraction> = ( <desired dim in px> / <resource dim
// in px> ) Note the empty resource is a 100x100px clip
var xscale = ((this.resourcewidth == 0) ? (v/100) : (v/this.resourcewidth));
+ this.__LZmovieClipRef._xscale = xscale * 100;
if (xscale == 0) xscale = 1;
this._xscale = xscale;
// clip scale is in percent
- this.__LZmovieClipRef._xscale = xscale * 100;
} else {
// If the view does not stretch, we have to resize the mask
// NOTE: [2008-01-24 ptw] This seems wrong. If the view is
@@ -650,10 +650,10 @@
// <scale as fraction> = ( <desired dim in px> / <resource dim
// in px> ) Note the empty resource is a 100x100px clip
var yscale = ((this.resourceheight == 0) ? (v/100) : (v/this.resourceheight));
+ this.__LZmovieClipRef._yscale = yscale * 100;
if (yscale == 0) yscale = 1;
this._yscale = yscale;
// clip scale is in percent
- this.__LZmovieClipRef._yscale = yscale * 100;
} else {
// If the view does not stretch, we have to resize the mask
// NOTE: [2008-01-24 ptw] This seems wrong. If the view is
@@ -700,6 +700,7 @@
* the loaded resource.
*/
LzSprite.prototype.updateResourceSize = function (skipsend){
+
var mc = this.getMCRef();
this.setWidth(this.hassetwidth?this.width:null);
this.setHeight(this.hassetheight?this.height:null);
@@ -709,8 +710,22 @@
this.resourceheight = rt.height;
} else {
// Get the true size by unscaling. Note: clip scale is in percent
- this.resourcewidth = Math.round(mc._width/(mc._xscale/100));
- this.resourceheight = Math.round(mc._height/(mc._yscale/100));
+ if (mc._xscale == 0) {
+ // special case if _xscale is zero, need to make it 100% to make measurement of resource width
+ mc._xscale = 100;
+ this.resourcewidth = Math.round(mc._width);
+ mc._xscale = 0;
+ } else {
+ this.resourcewidth = Math.round(mc._width/(mc._xscale/100));
+ }
+ if (mc._yscale == 0) {
+ // special case if _yscale is zero, need to make it 100% to make measurement of resource height
+ mc._yscale = 100;
+ this.resourcewidth = Math.round(mc._width);
+ mc._yscale = 0;
+ } else {
+ this.resourceheight = Math.round(mc._height/(mc._yscale/100));
+ }
}
if (! skipsend && ! this.__LZhaser) {
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as 2009-04-07 13:55:14 UTC (rev 13622)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as 2009-04-07 15:20:49 UTC (rev 13623)
@@ -1213,12 +1213,13 @@
if (res == null) return;
var scaleX:Number = 1.0;
- if (this.lzwidth && this._setrescwidth && this.resourcewidth) {
+
+ if (this.lzwidth != null && this._setrescwidth && this.resourcewidth) {
scaleX = this.lzwidth / this.resourcewidth;
}
var scaleY:Number = 1.0;
- if (this.lzheight && this._setrescheight && this.resourceheight) {
+ if (this.lzheight != null && this._setrescheight && this.resourceheight) {
scaleY = this.lzheight / this.resourceheight;
}
More information about the Laszlo-checkins
mailing list