[squeak-dev] How to Drag the Scenery

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

[squeak-dev] How to Drag the Scenery

Jim Rosenberg
I would like to implement a kind of portal class where the portal is a
viewer into a PasteUpMorph which is possibly much larger than the portal.
The PasteUpMorph is a submorph of the portal (and the portal itself is
likely a subclass of PasteUpMorph). The portal will have "active borders" a
few pixels wide. The behavior I want to implement will work like this:

If a drag is started from inside the border, it drags the underlying
PasteUpMorph with it.

I need some suggestions of code to read as an example of how to do this.

-Thanks in advance, Jim

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] How to Drag the Scenery

Herbert König
Hello Jim,

JR> I would like to implement a kind of portal class where the portal is a
JR> viewer into a PasteUpMorph which is possibly much larger than the portal.
JR> The PasteUpMorph is a submorph of the portal (and the portal itself is
JR> likely a subclass of PasteUpMorph). The portal will have "active borders" a
JR> few pixels wide. The behavior I want to implement will work like this:

are you aware of ZoomAndScrollMorph? And Balloon has 3D tilting.....

Never used it myself but always meant to look into it.


Cheers,

Herbert                                        


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] How to Drag the Scenery

Derek O'Connell-2
In reply to this post by Jim Rosenberg
ScreeningMorph may be a basic starting point. See here for simple
example: http://www.squeakcmi.org/library.php?sl=487

On 12/8/08, Jim Rosenberg <[hidden email]> wrote:

> I would like to implement a kind of portal class where the portal is a
> viewer into a PasteUpMorph which is possibly much larger than the portal.
> The PasteUpMorph is a submorph of the portal (and the portal itself is
> likely a subclass of PasteUpMorph). The portal will have "active borders" a
> few pixels wide. The behavior I want to implement will work like this:
>
>  If a drag is started from inside the border, it drags the underlying
> PasteUpMorph with it.
>
>  I need some suggestions of code to read as an example of how to do this.
>
>  -Thanks in advance, Jim
>
>

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] How to Drag the Scenery

K. K. Subramaniam
In reply to this post by Jim Rosenberg
On Tuesday 09 Dec 2008 1:29:59 am Jim Rosenberg wrote:

> I would like to implement a kind of portal class where the portal is a
> viewer into a PasteUpMorph which is possibly much larger than the portal.
> The PasteUpMorph is a submorph of the portal (and the portal itself is
> likely a subclass of PasteUpMorph). The portal will have "active borders" a
> few pixels wide. The behavior I want to implement will work like this:
>
> If a drag is started from inside the border, it drags the underlying
> PasteUpMorph with it.
>
> I need some suggestions of code to read as an example of how to do this.
This is same as "brown dragging" (as in using the move handle) the pasteup
within the portal. You can study the implementers and senders of
startDrag:with:, doDrag:with: and attachMorph:. Attach the morph to the hand
on startDrag and detach it on mouseUp.

HTH .. Subbu

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] How to Drag the Scenery

Jim Rosenberg
--On December 9, 2008 2:37:48 PM +0530 "K. K. Subramaniam"
<[hidden email]> wrote:


>> If a drag is started from inside the border, it drags the underlying
>> PasteUpMorph with it.

> This is same as "brown dragging" (as in using the move handle) the
> pasteup  within the portal. You can study the implementers and senders of
> startDrag:with:, doDrag:with: and attachMorph:. Attach the morph to the
> hand  on startDrag and detach it on mouseUp.

Thanks! attachMorph: is close, but there's a problem: it seems to do "black
dragging" (pickup). You're exactly right that "brown dragging" is what I
want to do -- the drag shouldn't change the underlying PasteUpMorph's
owner. Is there a "cousin" of attachMorph: that does this? Where's the
actual code for the Move halo?

-Thanks, Jim

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] How to Drag the Scenery

K. K. Subramaniam
On Tuesday 09 Dec 2008 10:21:53 pm Jim Rosenberg wrote:
> owner. Is there a "cousin" of attachMorph: that does this? Where's the
> actual code for the Move halo?
move or brown dragging is essentially a x,y translation op. The offset
computed as the difference between the current hand position and the position
at start of drag. It ends on mouseUp. The actual move is done in
setConstrainedPosition:hangOut:

see startDrag: evt with: dragHandle
        "Drag my target without removing it from its owner."
and doDrag: evt with: dragHandle

HTH .. Subbu