Changeset 49:2f52c296803c in xplra


Ignore:
Timestamp:
02/16/13 09:52:01 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Made the moving and resizing better looking

Location:
src/plugin/src/xplra
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/plugin/src/xplra/MessageWindow.cc

    r48 r49  
    7878    showForced(false),
    7979    hideTime(0.0),
     80    clickedX(-1),
     81    clickedY(-1),
     82    clickedLeft(-1),
     83    clickedTop(-1),
     84    clickedRight(-1),
     85    clickedBottom(-1),
    8086    duration(0.0)
    8187{
     
    172178        clickedX = x;
    173179        clickedY = y;
     180        clickedLeft = left;
     181        clickedTop = top;
     182        clickedRight = right;
     183        clickedBottom = bottom;
    174184    } else if (mouse==xplm_MouseDrag) {
    175185        int xDiff = x - clickedX;
    176186
    177187        if (mouseMode==MOUSE_MOVE) {
    178             int newLeft = left + xDiff;
    179             int newRight = right + xDiff;
     188            int newLeft = clickedLeft + xDiff;
     189            int newRight = clickedRight + xDiff;
    180190
    181191            int screenWidth = XPLMGetDatai(widthDataRef);
     
    186196
    187197            int yDiff = y - clickedY;
    188             int newTop = top + yDiff;
    189             int newBottom = bottom + yDiff;
     198            int newTop = clickedTop + yDiff;
     199            int newBottom = clickedBottom + yDiff;
    190200
    191201            int screenHeight = XPLMGetDatai(heightDataRef);
     
    195205            }
    196206        } else if (mouseMode==MOUSE_RESIZE_LEFT) {
    197             int newLeft = left + xDiff;
     207            int newLeft = clickedLeft + xDiff;
    198208            if (newLeft>=0 && (right-newLeft)>=minimalWidth) {
    199209                left = newLeft;
    200210            }
    201211        } else if (mouseMode==MOUSE_RESIZE_RIGHT) {
    202             int newRight = right + xDiff;
     212            int newRight = clickedRight + xDiff;
    203213            int screenWidth = XPLMGetDatai(widthDataRef);
    204214            if (newRight<screenWidth && (newRight-left)>=minimalWidth) {
     
    209219        XPLMSetWindowGeometry(windowID, left, top, right, bottom);
    210220
    211         clickedX = x;
    212         clickedY = y;
     221        // clickedX = x;
     222        // clickedY = y;
    213223    }
    214224
  • src/plugin/src/xplra/MessageWindow.h

    r48 r49  
    156156
    157157    /**
     158     * The left coordinate of the window when it was clicked.
     159     */
     160    int clickedLeft;
     161
     162    /**
     163     * The top coordinate of the window when it was clicked.
     164     */
     165    int clickedTop;
     166
     167    /**
     168     * The right coordinate of the window when it was clicked.
     169     */
     170    int clickedRight;
     171
     172    /**
     173     * The bottom coordinate of the window when it was clicked.
     174     */
     175    int clickedBottom;
     176
     177    /**
    158178     * The mutex protecting some of the data structures that are used
    159179     * from both the simulator loop and the server thread.
Note: See TracChangeset for help on using the changeset viewer.