Your contract is much clearer. Let's update the docs to reflect this.
I'll leave it in your capable hands now :)
Regards,
Max Carlson
OpenLaszlo.org
On 9/3/10 12:52 PM, P T Withington wrote:
Before I can review this, I _really_ have to understand what the contract of
getAttributeRelative is. The documentation appears to contradict itself:
* Transform the specified attribute (width/height/x/y) from the existing
* coordinate space to the reference view's coordinate space. This
* transformation takes into account any nested views between the views and
* the common ancestor view.
*
* This method answers the question: what should this view set its
* width/height/x/y to in order to appear to have the same value for that
* attribute as the reference view?
The first paragraph would appear to say, e.g., for `x`, "if I move to x=0 in this
view, what value of x in the reference view will get to the same absolute position".
The second paragraph seems to specify the same thing with this view and the reference
view reversed.
Perhaps we can intuit what people expect it to do and correct the documentation?
Kathryn's test case implies to me the contract is:
For x/y: What value of x/y in the reference view will be the same absolute
position as my current x/y?
For width/height: What distance in the x/y axis in the reference view will be
the same absolute distance as my current width/height.
Is that a contract we can all agree on?
On 2010-09-02, at 17:59, Max Carlson wrote:
Change maxcarlson-20100902-vX9 by maxcarl...@friendly on 2010-09-02 14:52:06 PDT
in /Users/maxcarlson/openlaszlo/trunk2
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Improve getAttributeRelative()
Bugs Fixed: LPP-9333 - lz.view getAttributeRelative() doesn't work with nested
views inside a view that has xscale/yscale
Technical Reviewer: ptw
QA Reviewer: [email protected]
Details: lztest-lzview.zlx - Add tests for getAttributeRelative(), clean up
older tests to be a bit more tolerant.
LzViewLinkage - downlink and uplink arrays now include the actual node, so
scaling computation is simpler. Use correct algoritm for determining scale and
offsets. Add typing.
LaszloView - Test for and return value immediately when refView === the curent
view. LzViewLinkage now includes the current view in the computation, so
there's no need to factor in its value here.
Tests: lztest-view.lzx runs as before in all runtimes - with fewer warnings.
This highlights issues with resourcewidth in swf10, but that's another ball of
wax.
Files:
M test/lztest/lztest-view.lzx
M WEB-INF/lps/lfc/views/LzViewLinkage.lzs
M WEB-INF/lps/lfc/views/LaszloView.lzs
Changeset:
http://svn.openlaszlo.org/openlaszlo/patches/maxcarlson-20100902-vX9.tar