Re: mouse position on Gnome2::Canvas and lines

On Mon, 2 Jun 2008 14:22:06 -0400
zentara <zentara1 sbcglobal net> wrote:


This just came up and I'm totally perplexed about how to position 
a line on a Canvas.

The first one, the (0,0,100,100) coordinates don't seem to
be at 0,0, and the points don't seem to jive with what I see
on screen.

The second one, I move root (-50,-50), and it seems to put the
coordinates at the origin, but a mouse click position is off.

And why -50,-50 ?  I would expect -250,-250 is $root was centered?

The line item dosn't have an anchor setting, so what do you use?

Can anyone explain how to set this up correctly?

See 2 attachments:



Doh!!!  Sorry I see the mistake. If the scrollregion is smaller than the default
canvas size, weird coordinate transforms occur. Maybe a bug?

$scroller->add( $canvas );                                                                
$window->add( $scroller );                                                                
$window->set_default_size( 500, 500 );                                                    
#if scrollregion is smaller than default size, odd                                        
# coordinate problems occur                                                               
#$canvas->set_scroll_region( 0, 0, 400, 400 ); #bad                                   
$canvas->set_scroll_region( 0, 0, 700, 700 );   #good and works fine

It would be a good "trick" question to throw at someone. :-)


I'm not really a human, but I play one on earth. 

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