After thinking about it I would have to say it does
make sense forget the dragsnap.js idea. The MotionX
library does not require dragevents.
MotionX is a very small library (4K) so I guess you
can add the snap codes to it. You could add a
_checkForSnap() function that's similar to
_checkForCollision()
DynLayer.prototype.makeSnapable = function(b){
if(!this.isHard) this.makeSolid();
// code here
};
DynLayer.prototype.setSnapBoundary =
function(t,r,b,l){
// code here
};
DynLayer.prototype._checkForSnap = function(t,r,b,l){
// code here
};
You could also add
DynLayer.prototype.setCollideBoundary =
function(t,r,b,l){
// code here
};
--
Raymond Irving
--- Leif W <[EMAIL PROTECTED]> wrote:
> Looking in MotionX now...
>
> Where I see _checkForCollision ... logically
> something like _checkForSnap
> would go nicely. And I see some other things I
> hadn't considered, such as
> direction/angle of snap. But would all changes go
> into motionx.js, and no
> api/ext/dragsnap.js?
>
> Leif
>
> ----- 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]/
__________________________________________________
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]/