I'm not too sure how to start the dragsnap.js file.  Could you give me a
hint/pointer like a skeleton file?  I'm looking at the api/ext/dragevent.js
file.  There's a DragEvent object, some global prototype variables, then
some methods added to DragEvent, which use a syntax I'm not familiar with
(the Name* below).  Do I need to use some syntax like this in my extension?
I noticed it doesn't use the Object.prototype.Method = function () {}
syntax.  Is there any difference?

Object.Method = function (args) {
    Name1 : function(args) {
        code;
    }
    Name2 : function(args) {
        code;
    }
}

I know I can't just copy dragevent.js to dragsnap.js and clobber the
"onmousemove" section to add only snap... the two have to coexist.  That's
why my initial thought was to modify the dragevent.js in the onmousemove
near the boundary code.  But for the sake of optimization / flexibility, the
suggestion to separate this functionality makes sense.  But I'm confused how
to get started.

About naming, I looked and setBoundary is in use somewhere, so I'd just call
it setSnapBoundary for now, and change it later if need be.

----- Original Message -----
From: "Raymond Irving" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 13, 2003 12:37 PM
Subject: Re: [Dynapi-Dev] Drag & Snap


>
> --- Leif W <[EMAIL PROTECTED]> wrote:
> > Ok, so where do I start adding / modifying code to
> > add some features like
> > Drag & Snap.  I'm thinking somewhere in the onmove
> > event.
>
> IMO I would recommend that the Snap functions be
> placed in a file call dragsnap.js and be placed in the
> api/ext directory (since it's an extension to the
> dynalyer and mouse events). Use the ondragemove event
> or the onmove event (invoked by motionx)
>
> > I'll need to first make some decisions about
> > functionality.  Do I add
> > attributes like (boolean) doSnap and (+t,+r,+b,+l)
> > snapBorder to the (either
> > static or dragged) dynlayer?  Does the doSnap apply
> > to the stationary
> > (non-draggable and draggable) target objects, such
> > that the draggable object
> > (which is currently moving) will snap to anything
> > that is snappable?  Or do
> > I only apply the doSnap to the currently moving
> > draggable layer, such that
> > it snaps to anything?  Or maybe both target/source
> > layers need the draggable
> > boolean set?
>
> And the a _snapEnabled property to all snap enabled
> layers by using either a doSnap(), setSnap() or
> enableSnap() function to the DynLayer.prototype
> object. For flexiblity it's best to make both non-drag
> and drag enabled layers snap-able. This way a use can
> create static objects that are snap enabled. For snap
> to take place the _snapEnabled property must be set to
> true for the colliding layers.
>
> > Second, how about the boundary implementation?
> > Thinking something like the
> > collision detection might come in handy.  But how to
> > set a wider boundary?
> > Do I put the snappable layer inside an invisible
> > "wrap" layer which is going
> > to be wider, and do collision detection on that?  Or
> > do I simply copy and
> > modify the collision code and rename it to some
> > snappable code, and do
> > collision detection on boundaries?
>
> For flexibility it would be best to modify the
> motionx.js file so that it supports a boundary
> feature. For exmaple:
>
> setCollideOffset(1) or
> setCollideOffset({top:3,bottom:5,left:6,right:10})
>
> I was thinking about setBoundrary but that might not
> be unique as other DynLayer extensions might use it in
> the future.
>
> The above would offer maximum flexibility to the user.
> The user can enter either an interger value or pass an
> object with top, bottom,right,left boundrary values.
>
> > Third, which files should I start looking in?  I've
> > got a copy of dynapi3x
> > and have been mucking around with it.
>
> You could the dragsnap.js modify the motionx.js (if
> you're going to use it). Another file to look at would
> be the dragdrop.js found in api/ext.
>
>
> PS. I think this library will be of great benefit to
> many users. Keep up the good work.
>
> Best regards,
>
>
> --
> Raymond Irving
>
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Shopping - Send Flowers for Valentine's Day
> http://shopping.yahoo.com
>
>
> -------------------------------------------------------
> This SF.NET email is sponsored by: FREE  SSL Guide from Thawte
> are you planning your Web Server Security? Click here to get a FREE
> Thawte SSL guide and find the answers to all your  SSL security issues.
> http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
> _______________________________________________
> Dynapi-Dev mailing list
> [EMAIL PROTECTED]
> http://www.mail-archive.com/[email protected]/




-------------------------------------------------------
This SF.NET email is sponsored by: FREE  SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your  SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/[email protected]/

Reply via email to