Author: max
Date: 2007-09-25 15:04:25 -0700 (Tue, 25 Sep 2007)
New Revision: 6595
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs
openlaszlo/trunk/test/lztest/lztest-view.lzx
Log:
Change 20070925-maxcarlson-7 by [EMAIL PROTECTED] on 2007-09-25 13:55:11 PDT
in /Users/maxcarlson/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Fix xoffset and yoffset
New Features:
Bugs Fixed: LPP-4778 - "LzView#setX(..)" and "LzView#setY(..)" optimization
breaks xoffset / yoffset
Technical Reviewer: promanik
QA Reviewer: bargull
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details: lztest-view.lzx - add test for x/yoffset and one with rotation.
LaszloView.lzs - Add correct initial values for _x, _y, _width, _height. Add
argument to setX/setY() to override cached values.
setRotation/setXOffset/setYOffset() call setX/setY() with force set to true.
Tests: Run updated lztest-view.lzx with and without the changes to
LaszloView.lzs. You should see the test fail without the LaszloView changes.
Tested in swf7/8/dhtml.
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs 2007-09-25
21:02:27 UTC (rev 6594)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs 2007-09-25
22:04:25 UTC (rev 6595)
@@ -743,6 +743,10 @@
/** @access private */ var __LZoutlieheight = null;
/** @access private */ var __LZoutliewidth = null;
/** @access private */ var __LZsubUniqueNum = null;
+/** @access private */ var _x = 0;
+/** @access private */ var _y = 0;
+/** @access private */ var _width = 0;
+/** @access private */ var _height = 0;
/**
* this creates a specific child layout for this view. When called a second
time
@@ -1287,8 +1291,8 @@
* Sets the <attribute>x</attribute> position of the view to the given value.
* @param Number v: The new value for <attribute>x</attribute>.
*/
-function setX ( v ){
- if (this._x != v) {
+function setX ( v, force ){
+ if (force || this._x != v) {
this._x = v;
this.x = v;
if ( this.__LZhasoffset ){
@@ -1314,8 +1318,8 @@
* Sets the <attribute>y</attribute> position for the view to the given value.
* @param Number v: The new value for <attribute>y</attribute>.
*/
-function setY ( v ){
- if (this._y != v) {
+function setY ( v, force ){
+ if (force || this._y != v) {
this._y = v;
this.y = v;
if ( this.__LZhasoffset ){
@@ -1353,8 +1357,8 @@
if (this.onrotation.ready) this.onrotation.sendEvent( v );
if ( this.__LZhasoffset ){
- this.setX( this.x );
- this.setY( this.y );
+ this.setX( this.x, true );
+ this.setY( this.y, true );
}
if (this.immediateparent.__LZcheckwidth)
@@ -1396,8 +1400,8 @@
function setXOffset ( o ){
this.__LZhasoffset = o != 0;
this.xoffset = o;
- this.setX( this.x );
- this.setY( this.y );
+ this.setX( this.x, true );
+ this.setY( this.y, true );
if (this.onxoffset.ready) this.onxoffset.sendEvent( o );
}
@@ -1408,8 +1412,8 @@
function setYOffset ( o ){
this.__LZhasoffset = o != 0;
this.yoffset = o;
- this.setX( this.x );
- this.setY( this.y );
+ this.setX( this.x, true );
+ this.setY( this.y, true );
if (this.onyoffset.ready) this.onyoffset.sendEvent( o );
}
Modified: openlaszlo/trunk/test/lztest/lztest-view.lzx
===================================================================
--- openlaszlo/trunk/test/lztest/lztest-view.lzx 2007-09-25 21:02:27 UTC
(rev 6594)
+++ openlaszlo/trunk/test/lztest/lztest-view.lzx 2007-09-25 22:04:25 UTC
(rev 6595)
@@ -143,13 +143,12 @@
</view>
-<!-- viewN: rotations, around the center -->
-<!-- leave for later
- <view name="view5" bgcolor="yellow">
+<!-- view14: rotations, around the center -->
+ <view name="view14" bgcolor="yellow">
+ <simplelayout/>
<view name="v1" bgcolor="green" width="20" height="10" xoffset="10"
yoffset="5" rotation="45"/>
- <simpleboundslayout name="layout" axis="x"/>
+ <view name="v2" bgcolor="red" width="20" height="10" xoffset="10"
yoffset="5"/>
</view>
--->
@@ -180,10 +179,10 @@
// Inspect [x,y,width,height] and compare with the specified view
function loctest(msg,view,exp)
{
- LzTestManager.assertEquals (exp[0], view.x, msg + ": x failure");
- LzTestManager.assertEquals (exp[1], view.y, msg + ": y failure");
- LzTestManager.assertEquals (exp[2], view.width, msg + ": width failure");
- LzTestManager.assertEquals (exp[3], view.height, msg + ": height failure");
+ LzTestManager.assertWithin (exp[0], view.sprite.x, .1, msg + ": x failure");
+ LzTestManager.assertWithin (exp[1], view.sprite.y, .1, msg + ": y failure");
+ LzTestManager.assertWithin (exp[2], view.sprite.width, .1, msg + ": width
failure");
+ LzTestManager.assertWithin (exp[3], view.sprite.height, .1, msg + ": height
failure");
}
@@ -463,6 +462,10 @@
// Built-into object view14
}
+suite.test14 = function() {
+ if (view14.capabilities.rotation) loctest ('view14', view14.v1,
[-3.53553390593274,-10.6066017177982,20,10]);
+ loctest ('view14', view14.v2, [-10,5,20,10]);
+}
/* Leave for last
suite.testN = function() {
var b = view5.v1.getBounds();
@@ -484,6 +487,7 @@
suite.addTest(suite.test11);
suite.addTest(suite.test12);
suite.addTest(suite.test13);
+suite.addTest(suite.test14);
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins