Ruby Forum Ruby-Gnome 2 > cairo translate with mouse dragging

Posted by KONTRA, Gergely (Guest)
on 28.04.2008 20:28
(Received via mailing list)
http://pastebin.com/d1a425431

Hi all!

I would like to have a DrawingArea + Cairo, which is zoomable and 
pannable.

The Zoomable aspect is done by me, but I do not know how to implement
the pannable.

Which Gdk::Event should I enable to handle panning with left or middle
button drag?
Which signal to connect to?

thanks
Gergo

--
+-[ Gergely Kontra <pihentagy@gmail.com> ]------------------+
|                                                           |
| Mobile:(+36 20)356 9656                                   |
|                                                           |
+- "Olyan lángész vagyok, hogy poroltóval kellene járnom!" -+
Posted by Detlef Reichl (Guest)
on 28.04.2008 22:43
(Received via mailing list)
Am Montag, den 28.04.2008, 18:32 +0200 schrieb KONTRA, Gergely:
> button drag?
> Which signal to connect to?
> 

Hi,

check for Gdk::Event::BUTTON_PRESS for start of dragging, observe the
dragging with Gdk::Event::MOTION_NOTIFY and end it with
Gdk::Event::BUTTON_RELEASE . To get the information, wich button is
pressed use event.button from the signal handler.

Cheers, detlef
Posted by KONTRA, Gergely (Guest)
on 29.04.2008 10:19
(Received via mailing list)
I thought BUTTON1_MOTION_MASK has to do something with dragging with
button1, but maybe I was wrong...

On Mon, Apr 28, 2008 at 9:34 PM, Detlef Reichl <detlef.reichl@gmx.org> 
wrote:
>  > the pannable.
>  Gdk::Event::BUTTON_RELEASE . To get the information, wich button is
>  This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>  Don't miss this year's exciting event. There's still time to save $100.
>  Use priority code J8TL2D2.
>  http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
>  _______________________________________________
>  ruby-gnome2-devel-en mailing list
>  ruby-gnome2-devel-en@lists.sourceforge.net
>  https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en
>



--
+-[ Gergely Kontra <pihentagy@gmail.com> ]------------------+
|                                                           |
| Mobile:(+36 20)356 9656                                   |
|                                                           |
+- "Olyan lángész vagyok, hogy poroltóval kellene járnom!" -+
Posted by KONTRA, Gergely (Guest)
on 29.04.2008 10:23
(Received via mailing list)
And what about the drag-motion signal? What should I type to
add_events to be able to catch that? Or is that for something else?

On Tue, Apr 29, 2008 at 10:18 AM, KONTRA, Gergely <pihentagy@gmail.com> 
wrote:
>  >  >
>  >  >
>  >  > thanks
>  >  ruby-gnome2-devel-en mailing list
>  |                                                           |
>  | Mobile:(+36 20)356 9656                                   |
>  |                                                           |
>  +- "Olyan lángész vagyok, hogy poroltóval kellene járnom!" -+
>



--
+-[ Gergely Kontra <pihentagy@gmail.com> ]------------------+
|                                                           |
| Mobile:(+36 20)356 9656                                   |
|                                                           |
+- "Olyan lángész vagyok, hogy poroltóval kellene járnom!" -+
Posted by KONTRA, Gergely (Guest)
on 29.04.2008 16:27
(Received via mailing list)
Hi!

Thanks for the reply, I have completed the example, and refactored the
reusable parts.
(DragZoomDrawingArea should be reusable class)

Here is it:
http://pastebin.com/f63c6aaa9

Zooming respect current mouse position

On Mon, Apr 28, 2008 at 9:34 PM, Detlef Reichl <detlef.reichl@gmx.org> 
wrote:
>  > the pannable.
>  Gdk::Event::BUTTON_RELEASE . To get the information, wich button is
>  This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>  Don't miss this year's exciting event. There's still time to save $100.
>  Use priority code J8TL2D2.
>  http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
>  _______________________________________________
>  ruby-gnome2-devel-en mailing list
>  ruby-gnome2-devel-en@lists.sourceforge.net
>  https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en
>



--
+-[ Gergely Kontra <pihentagy@gmail.com> ]------------------+
|                                                           |
| Mobile:(+36 20)356 9656                                   |
|                                                           |
+- "Olyan lángész vagyok, hogy poroltóval kellene járnom!" -+