Christoffer Sørensen wrote:
> This is my OnMove method:
> 
> def OnMove(self, event):
>         # Allways raise the Move event.
>         self.Canvas._RaiseMouseEvent(event,FloatCanvas.EVT_FC_MOTION)
>         if event.Dragging() and event.LeftIsDown() and not
> self.StartMove is None:
>               StartMove = self.StartMove
>               EndMove = N.array(event.GetPosition())
>               DiffMove = StartMove-EndMove
>               if N.sum(DiffMove**2) > 16:
>                       self.Canvas.MoveImage(DiffMove, 'Pixel')

That's pretty much what I had in mind.

> it works, however it is not really fluent; I guess it caused by the
> constant updating, hence we need the timer stuff you mentioned.

You can take a look at the code in FloatCanvas.py:

FloatCanvas.OnSize() and .OnSizeTimer(). There is not much to it.

But now that I look at it, you might try increasing that "16" some -- 
then it would draw a little less frequently.

But anyway, that's why I did it the way I did before.

to get it really smooth, I suppose you could render a larger bitmap off 
screen, so you could just drag that as you moved, and have floatcanvas 
fill in the missing bits when they are still off screen.

Personally, I find that having just the previously visible part move 
smooth is good enough for me.

> Ideally I would also like to load a SVG directly since I find it
> easier to draw an image in inkscape than to build my image by hand.
> However, I know that is not supported by floatcanvas.

And, and Mattias mentions, is non-trivial. Would you need your SVG 
images scalable? or could you just use InkScape to render bitmaps, and 
use them in FloatCanvas?

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[EMAIL PROTECTED]

_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to