Ejemplo n.º 1
0
bool StGLRootWidget::doScroll(const StScrollEvent& theEvent) {
    const StPointD_t aCursorBack = cursorZo;
    cursorZo = StPointD_t(theEvent.PointX, theEvent.PointY);

    const bool aResult = StGLWidget::doScroll(theEvent);
    clearDestroyList();
    cursorZo = aCursorBack;
    return aResult;
}
Ejemplo n.º 2
0
bool StGLRootWidget::tryClick(const StClickEvent& theEvent,
                              bool&               theIsItemClicked) {
    const StPointD_t aCursorBack = cursorZo;
    cursorZo = StPointD_t(theEvent.PointX, theEvent.PointY);
    if(isPointIn(cursorZo)) {
        setClicked(theEvent.Button, true);
    }
    const bool aResult = StGLWidget::tryClick(theEvent, theIsItemClicked);
    cursorZo = aCursorBack;
    return aResult;
}
Ejemplo n.º 3
0
bool StGLScrollArea::tryClick(const StClickEvent& theEvent,
                              bool&               theIsItemClicked) {
    if(!isVisibleAndPointIn(StPointD_t(theEvent.PointX, theEvent.PointY))) {
        return false;
    }

    if( theEvent.Button == ST_MOUSE_LEFT
    && !theIsItemClicked
    &&  isScrollable()) {
        myIsLeftClick = true;
        myHasDragged  = false;
        myClickPntZo  = StPointD_t(theEvent.PointX, theEvent.PointY);
        myDragYCumul  = 0;

        // abort flinging
        if(myFlingTimer.isOn()) {
            const double aTime  = myFlingTimer.getElapsedTime();
            const double anA    = (myFlingYSpeed > 0.0 ? -1.0 : 1.0) * myFlingAccel;
            const double aSpeed = myFlingYSpeed + anA * aTime;
            if(std::abs(aSpeed) > myRoot->scale(300)) {
                setClickedWithChildren(myChildren, ST_MOUSE_LEFT, false);
                theIsItemClicked = true;
                return true;
            }
        }
    } else {
        myIsLeftClick = false;
        myHasDragged  = false;
    }

    if(StGLWidget::tryClick(theEvent, theIsItemClicked)) {
        theIsItemClicked = true;
        return true;
    }
    return false;
}
Ejemplo n.º 4
0
StPointD_t StGLWidget::getPointIn(const StPointD_t& thePointZo) const {
    const StRectD_t aRectGl = getRectGl();
    StPointD_t aPointGl = getPointGl(thePointZo);
    return StPointD_t((aPointGl.x() - aRectGl.left()) / (aRectGl.right() - aRectGl.left()),
                      (aRectGl.top() - aPointGl.y())  / (aRectGl.top() - aRectGl.bottom()));
}
Ejemplo n.º 5
0
StPointD_t StGLWidget::getPointGl(const StPointD_t& thePointZo) const {
    double oglWidth  = myRoot->getRootRectGl().right() - myRoot->getRootRectGl().left();
    double oglHeight = myRoot->getRootRectGl().top() - myRoot->getRootRectGl().bottom();
    return StPointD_t((thePointZo.x() - 0.5) * oglWidth,
                      (0.5 - thePointZo.y()) * oglHeight);
}