From: Brian H. <bg...@ke...> - 2003-10-01 10:14:25
|
Raymond, I noticed your code looks different than mine... Try this. And you should see what I am talking about. 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); DragEvent.setDragBoundary(insideObj, {left:0, right:0, top:0, bottom:0}); DragEvent.enableDragEvents(insideObj) dynapi.document.addChild(container); Brian Hayes -----Original Message----- From: dyn...@li... [mailto:dyn...@li...] On Behalf Of Raymond Irving Sent: Wednesday, October 01, 2003 12:43 AM To: dyn...@li... Subject: RE: [Dynapi-Help] Where does this need to be poted? Hi, I'm unable to reproduct the choppy behaviour. Here's the code I'm using: 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); DragEvent.enableDragEvents(container,insideObj) dynapi.document.addChild(container); Could you provide an online demo of this error? -- Rayond Irving --- Brian Hayes <bg...@ke...> wrote: > 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. > __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Dynapi-Help mailing list Dyn...@li... https://lists.sourceforge.net/lists/listinfo/dynapi-help |