Seaside + Scriptaculous draggable onEnd: question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Seaside + Scriptaculous draggable onEnd: question

Dmitry Dorofeev
Hello all.

I am new to this and it is not quite easy to find any good docs online except a Squeak image in my hands.

The idea is to allow user to select a fixed size square area in the picture all controlled by my seaside app.

to do so I gonna use Scriptaculous, something like:

html image url: 'test.png';
        id: 'picture';
        width: 800;
        height: 600.

html div id: 'square-selector';
        style: 'border: solid 1px red; width: 432px; height: 432px; position relative; background: transparent';
  script: (
                html draggable revert: false;
                onEnd: ()
        ).

The question is what to put into onEnd: () ???

I want to check drop location of my square-selector inside the picture, adjust it if user went outside the picture
and finally have x and y of top left corner of my square-selector relative to picture stored in ivars (which is trivial).

http://scriptaculous.seasidehosting.st/ examples seems to show that it is possible, but not very clear how to do it.

Please help

Thanks

-Dmitry.


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside + Scriptaculous draggable onEnd: question

Lukas Renggli
>  The question is what to put into onEnd: () ???

Some JavaScript code ;-)

For example, put the following code into #onEnd:, if you want to
trigger a callback on the server to get the new coordinates of the
rectangle:

html request
    callback: [ :value | value inspect ]
    value: (html element
         id: 'square-selector';
         offsetParent)

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside