CLIM mail archive

[Prev][Next][Index][Thread]

Re: dragging



  Date: Thu, 17 Dec 1992 11:57:17 +0100
  From: Dietmar Pree <dp@cast.uni-linz.ac.at>
  To: clim@BBN.COM
  
  I am searching for a (very) efficient way to code a function like
     
     clim:dragging-output-record stream output-record & key (:repaint t)
     
     which enters an interaction mode in which the user moves the
     pointer, and output-record is RESIZED (and not dragged !!!) on stream
     when the pointer is moved.
     
In general, all dragging or "rubberbanding" should be done this way:

Use tracking-pointer to get reports on mouse motion.  Each time
the mouse moves, you:

  1.  erase (that is, draw with the flip ink) at the old position
  2.  display (that is, draw with the flip ink) at the new position

Obviously you need a display function that takes INK as one
of its arguments.

In your case, the display function should also take some sort of
size arguments that are a function of the mouse position.  Then you:

  1.  erase (that is, draw with the flip ink) at the old size
  2.  display (that is, draw with the flip ink) at the new size

Display should be done with output recording disabled because there is
no point recording what you are going to erase the next time the mouse
moves.  With output recording disabled, the display function probably
won't take longer than a fraction of a second, and the animation
effect will seem real enough.  Dragging with output recording
enabled is almost always wrong.  When you are done dragging, you can
draw it once with output recording enabled to make it persist.

As Scott said yesterday, if your display is NOT changing shape or size,
but only position, then you can use a pixmap as a sort of cache,
drawing just once to the pixmap, then displaying and erasing the pixmap
inside the inner loop.  This is possibly the most efficient way to
do dragging, with or without clim.

jeff morrill

0,,

Follow-Ups: References:

Main Index | Thread Index