Login | Register
My pages Projects Community openCollabNet

Discussions > dev > GEF Bug Fix / #274

gef
Discussion topic

Back to topic list

GEF Bug Fix / #274

Reply

Author "Edward J dot Lyons Jr dot " <ed at netnumina dot com>
Full name "Edward J dot Lyons Jr dot " <ed at netnumina dot com>
Date 2001-01-06 16:26:14 PST
Message Hello Thorsten et. al -

Two days ago, I submitted a fix so you couldn't drag selections off the
screen permanently. However, I forgot to put in a fix so that you cannot
drag selection handles (corners) off the screen. (I believe that this will
solve the problem my colleague and friend Larry Kim noticed in #274. His
problem might also have been caused by bug # 292, which was whole objects
being dragged permanently out of view)

Fixing the handle drag problem requires that another method be put into
ModeModify and that it is called from mouseDragged() in the same file.

The line to be changed is around line 170 of ModeModify. That code that
does the handle drag needs to be bracketed by a check to the new
handleOutOfBounds() method:

      // Making sure we're not dragging handle off the drawing area
      if (!handleOutOfBounds(me)) {
        sm.dragHandle(snapX, snapY, _anchor.x, _anchor.y, _curHandle);
        _lastX = snapX; _lastY = snapY;
      }

Here is the new method:

 /**
   * This method will check to see if the selection handle is being dragged
   * off the drawing area.
   *
   * @param me - the mouse event we care about
   * @returns boolean - is handle out of bounds? ( T / F )
   */
  protected boolean handleOutOfBounds(MouseEvent me) {

    if (me.getX() < 1) return true;
    if (me.getY() < 1) return true;

    if (me.getX() > me.getComponent().getWidth()) return true;
    if (me.getY() > me.getComponent().getHeight()) return true;

    // Otherwise we're ok!
    return false;
  }

Naturally, I have tested the fix and it works great. I have attached the new
copy of ModeModify.java to this email.

Let me know if you have any questions.

Sincerely,

Ed Lyons
Attachments

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

GEF Bug Fix / #274 "Edward J dot Lyons Jr dot " <ed at netnumina dot com> "Edward J dot Lyons Jr dot " <ed at netnumina dot com> 2001-01-06 16:26:14 PST
Messages per page: