distanceTo()
Charles Goodwin <[email protected]> Thu, 01 Apr 2004 22:19:31 +0000
| Newsgroups | gmane.comp.java.xwt.core |
|---|---|
| Organization | XWT Foundation |
| Message-ID | <[email protected]> |
Should this be:
$box1.distanceTo($box2) returning [Vx,Vy] or {x:Vx,y:Vy}
Or:
$box1.dx($box2) returning Vx and
$box1.dy($box2) returning Vy
I ask because the vast majority of uses for distanceTo() will require
directly using one or both of the individual parts of the result. It'd
probably be much more convenient to just use the second method for both
the core and with Ibexscript.
It's relatively trivial, I guess it's just the difference between:
var d = $box1.distanceTo($box2);
x += d.x;
y += d.y;
And:
var dx = $box1.dx($box2);
var dy = $box1.dy($box2);
x += dy;
y += dy;
I just prefer the second way of doing it. A tiny bit less effort done
by the core (no forming of an object) if you want to do lots of
manipulation with just one of the values.
--
- Charlie
Charles Goodwin <[email protected]>
Online @ http://www.charlietech.com