|
From: Kevin <ke...@ke...> - 2003-09-22 23:44:57
|
"Leif W" <war...@us...> wrote:
> I'm wondering if it'd make sense to have something like a getParent(N) where
> N is optional, and if specified, refers to the number of parents above the
> current layer. I'm looking through the code for some way to identify if
> it's a dynlayer or just a window object. I don't know offhand but I have a
> hunch. I just can't seem to find the right bit of code to do it yet.
>
> Leif
You could use the utility method getClassName. ie.
if (lyr.getClassName()=='DynLayer')
-
Kevin
> ----- Original Message -----
> From: Brian Hayes
> To: dyn...@li...
> Sent: Sunday, September 21, 2003 10:58 AM
> Subject: RE: [Dynapi-Help] Where does this need to be poted?
>
>
> O.k I just did a little test, and the below code only seems to work if you
> put a layer inside a layer, but if your layer is larger than your page (not
> in side a layer, but simply on added to the page) it doen't work.. So, how
> can you tell if your parent layer is the window or a DynLayer? Or again, i'm
> sure its the below code..or, possibly not being able to detect a window size
> change??
>
>
>
>
> From: dyn...@li...
> [mailto:dyn...@li...] On Behalf Of Brian Hayes
> Sent: Sunday, September 21, 2003 10:50 AM
> To: dyn...@li...
> Subject: [Dynapi-Help] Where does this need to be poted?
>
> Dear developer's,
>
> I wanted to share a code change that I made today with version
> 3, as it relates to the setDragBoundary function is DragEvents. I noticed
> that when you enable boundaries and you have this within a containing object
> that was smaller than the one with limits you would get very choppy
> behavior. I worked around this by using the eventlistener "ondragmove" and
> "ondragstop", by setting my location based on the area of my container..
> Then it hit me, while working on the dynapi.function.getimage and some guys
> from work whom specialize in oop style programing.. add the code to the core
> dragevent.js file (line 113), and not longer worry about it.. So here it is,
> and please let me know what could do better (if any, as math is hard for me
> to visualize)..
>
> Origianal Code..
> //if (x<l) x = l;
> //else if
> (x>lyr.parent.w-lyr.w-r) x = lyr.parent.w-lyr.w-r;
> //if (y<t) y = t;
> //else if
> (y>lyr.parent.h-lyr.h-b) y = lyr.parent.h-lyr.h-b;
>
> New Code..
> if(lyr.parent.w>lyr.w){ //
> We are in a container larger than we are, so use the orignal code..
> if (x<l) x = l;
> else if
> (x>lyr.parent.w-lyr.w-r) x = lyr.parent.w-lyr.w-r;
> if (y<t) y = t;
> else if
> (y>lyr.parent.h-lyr.h-b) y = lyr.parent.h-lyr.h-b;
> } else
> if(lyr.parent.w<lyr.w){ //opps we are larger than our container, so make us
> smother to our areas..
> if ( (x*-1) < l)
> x = l;
> else if (
> ((x*-1) +lyr.parent.w-r) >= lyr.w) x = lyr.parent.w-lyr.w-r;
> if ( (y*-1) < t)
> y = t;
> else if (
> ((y*-1) +lyr.parent.h-b) >= lyr.h) y = lyr.parent.w-lyr.h-b;
> }
>
> The above allows the borders to flow very smooth.. Please let me know what
> you think, and if you have a cleaner way of writing the above..
>
> Example:
>
> var container = new DynLayer(null,0,0,200,200,"e0e0e0");
> var insideObj = new DynLayer("Inside",0,0,400,400, "blue"); larger than our
> container...
> container.addChild(insideObj);
> dynapi.document.addChild(container);
> dynapi.document.insertAllChildren();
>
> Thanks... Brian Hayes.
>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Dynapi-Dev mailing list
> Dyn...@li...
> http://www.mail-archive.com/dyn...@li.../
|