looking at the code segment the line:
if/color> (this.isChild) {
could be interpreted as:
if (this.parent instanceof dynLayer){
The idea being that (at the time) the
dynDocument did not have the methods getPageX() and getPageY()
and an error would be produced.
So yes. We can remove isChild.
In any case where we would want to test if the
parent is a dynlayer just use:
if (this.parent instanceof dynLayer){
Later.
----- Original Message -----
Sent: Wednesday, February 26, 2003 1:38
PM
Subject: [Dynapi-Dev] isChild utility
?
I don't see much usage of this in dynapi3 except in these
methods, and even there I don't think it's usefull. What's the point of
having a isChild when you have a parent property ? No dynlayer is supposed
to be parent less, right ? They're either child of the dyndocument or child of
another dynlayer. So unless I miss something, which I might ! We could get
rid of it ! Plus in the following functions, event when the parent is the
document, getPageX() and getPageY() will return 0 and you would end up with
the same result, right ?
The question is, does dynapi3 is meant to
support layers that don't have a parent property, because that's required if
you remove the isChild test in these 2 methods.
p.setPageLocation =
function/color>(x,y) { if/color> (this.isChild) { if/color> (x!=null) x = x -
this.parent.getPageX(); if/color>
(y!=null) y = y - this.parent.getPageY(); } return/color>
this.setLocation(x,y); };
p.getPageX=function/color>()
{return/color> (this.isChild)?
this.parent.getPageX()+(this.x||0/color>) :
this.x||0/color>}; p.getPageY=function/color>()
{return/color> (this.isChild)?
this.parent.getPageY()+(this.y||0/color>) :
this.y||0/color>};
Benoit
|