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: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brian Hayes 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. |
- [Dynapi-Help] Where does this need to be poted? Brian Hayes
- Re: [Dynapi-Help] Where does this need to be poted? Brian Hayes
- Re: [Dynapi-Help] Where does this need to be poted? Raymond Irving