> I am writing an application where in reaction to rotating the mouse wheel > (FL_MOUSEWHEEL event) I am updating an image which gets drawn on the > screen via fl_draw_image(). (The image represents a 2D slice out of a 3D > medical image volume). At slow mouse wheel rotation speeds everything > works quite well. But if the user rotates the wheel too fast then things > start getting sluggish. The problem is that the mouse wheel events come in > faster than it takes to update the image. What I would like to do is > skipping the image update for intermediate mouse wheel events. Is there a > way to do this in FLTK 1.3? E.g., can I somehow check if there are > FL_MOUSEWHEEL events queued up, and if so, work them off without redrawing > for each individual one (just the last one)?
Sure, I've done this before - though it may depend on how exactly your code is currently structured... All I do is gather the mouse wheel events in the handle method for the widget, which I assume you must be doing, but I do not trigger a redraw for every event, rather I accumulate the movement events into a running total in the handler. The actual redraw I trigger from an fl_timeout so that I get a reasonably constant frame rate - when the timeout fires, it looks to see if any mouse wheel stuff has happened, and if so it clears the accumulator down to zero again and triggers the appropriate redraw. That may not fit too well with your current scheme though, perhaps, but it works well for me. A frame rate of about 20Hz seems to be fine for most cases (though for really complex scenes I don't quite make that anyway...!) Hope that helps... -- Ian SELEX Galileo Ltd Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL A company registered in England & Wales. Company no. 02426132 ******************************************************************** This email and any attachments are confidential to the intended recipient and may also be privileged. If you are not the intended recipient please delete it from your system and notify the sender. You should not copy it or use it for any purpose nor disclose or distribute its contents to any other person. ******************************************************************** _______________________________________________ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk