OGL - wxShape:OnMove problem

Hi

I'm trying to animate my shape so that it will follow the mouse pointer when
the left mouse button is down.

To do this I'm overriding OnDragLeft and calling the shapes Move method. The
problem is that the shape doesn't get erased from the canvas unless i call
the canvas Refresh method. This refreshes the whole canvas (and not only the
shapes device context), and is a very heavy operation that makes all shapes
flash (doesn't look good).

I've tried Diagram.Redraw(dc), but it doesn't work. Any ide why?

Another solution is to erase the shape on the first call on OnDragLeft
(which is called twice) and draw it again on the second. But this leads to
another problem, that it will erase other shapes that is moved over.

Regards,
Thomas

Thomas wrote:

Hi

I'm trying to animate my shape so that it will follow the mouse pointer when
the left mouse button is down.

To do this I'm overriding OnDragLeft and calling the shapes Move method. The
problem is that the shape doesn't get erased from the canvas unless i call
the canvas Refresh method. This refreshes the whole canvas (and not only the
shapes device context), and is a very heavy operation that makes all shapes
flash (doesn't look good).

You could try getting the rectangle occupied by the shape before and after the move (in window coordinants,) combine them, and pass that rect to Refresh. Then only that much will be redrawn and the rest should be left alone.

Another possibility is to iterate over the shapes and find those that intersect that rectangle and then call their Draw methods with the DC you already have.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Hi

What you wanted to do is what I want to do now, if you have realized such
function, could you give me a demo?

···

--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/OGL-wxShape-OnMove-problem-tp2293495p5717169.html
Sent from the wxPython-users mailing list archive at Nabble.com.