Re: Goocanvas reactions after a mouse event



On Mon, 2010-05-31 at 18:28 +0200, luc wrote:
> Hello !
> We're developping a project of 'animation software' fund upon Goocanvas,
> Ella for 'Elegent Light Linux Animator' ; this project started last
> year, and now we plan to release the first true public release (0.1) ;
> 
> But, there is a concern with Goocanvas management of 'mouse events' in
> some case, like this example : consider a GoocanvasItem which is
> rotated. In Ella, we're using an 'editor' window, like in Macromedia
> Flash. If we wants to drag and drop this item, it appears taht the
> complete axis coordinates are aloso rotated ! So, if the mouse pointer
> is dragged to the left, the 'mouse event handler of Goocanvas reads the
> correct mouse coordinates, BUT, if we want to draw a nex GoocanvasItem,
> the NEW item uses, by default, the last item rotation angle !
> Here is the code :
> 
> ----------------------------
> gboolean cb_editor_mouse_move(GooCanvasItem  *item,
> 		      GooCanvasItem  *target,
> 		      GdkEventButton *event,
> 		      GtkWidget        *win)
> {	
> 	gdouble angle;
>         GooCanvas *canvas;	
> 
> (....)
> 	if ((EditorMode==EDITOR_MODE_MOVE)&&(fdrawing)&&(SelectedArea))
> 	  {	  	    
> 		
> 	       goo_canvas_item_remove(pDrawings);/* removing the selection box
> */  
> 	            	 
> 	       selection_box(item, x2drw,y2drw,x2drw+wsel,y2drw+hsel);	 /*
> drawing the new rotation box        */
> 	  	   return TRUE;
> --------------------------------------
> It seems that the 'item' variable, managed by Goocanvas, isn't really
> initialized

I'm not sure I understand the problem.

Do you want the event coordinates to be relative to the entire canvas
instead of relative to the rotated item? If so, you can use
event->x_root and y_root.

Or you could connect the signal handler to the root item of the canvas.

Does that help?

Damon




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]