| 944 | } |
| 945 | |
| 946 | void |
| 947 | TimeLineGui::mouseMoveEvent(QMouseEvent* e) |
| 948 | { |
| 949 | int mouseMoveXprev = _imp->mouseMoveX; |
| 950 | |
| 951 | _imp->lastMouseEventWidgetCoord = e->pos(); |
| 952 | _imp->mouseMoveX = e->x(); |
| 953 | const double t = toTimeLine(_imp->mouseMoveX); |
| 954 | SequenceTime tseq = std::floor(t + 0.5); |
| 955 | bool distortViewPort = false; |
| 956 | bool onEditingFinishedOnly = appPTR->getCurrentSettings()->getRenderOnEditingFinishedOnly(); |
| 957 | if (_imp->state == eTimelineStatePanning) { |
| 958 | _imp->tlZoomCtx.left += toTimeLine(mouseMoveXprev) - toTimeLine(_imp->mouseMoveX); |
| 959 | update(); |
| 960 | if ( _imp->gui->isTripleSyncEnabled() ) { |
| 961 | _imp->updateEditorFrameRanges(); |
| 962 | _imp->updateOpenedViewersFrameRanges(); |
| 963 | } |
| 964 | } else if (_imp->state == eTimelineStateSelectingZoomRange) { |
| 965 | // https://github.com/MrKepzie/Natron/issues/917 |
| 966 | update(); |
| 967 | } else if ( (_imp->state == eTimelineStateDraggingCursor) && !onEditingFinishedOnly ) { |
| 968 | if ( tseq != _imp->timeline->currentFrame() ) { |
| 969 | _imp->gui->setDraftRenderEnabled(true); |
| 970 | _imp->gui->getApp()->setLastViewerUsingTimeline( _imp->viewer->getNode() ); |
| 971 | _imp->seekingTimeline = true; |
| 972 | _imp->timeline->onFrameChanged(tseq); |
| 973 | _imp->seekingTimeline = false; |
| 974 | } |
| 975 | distortViewPort = true; |
| 976 | _imp->alphaCursor = false; |
| 977 | } else if (_imp->state == eTimelineStateDraggingBoundary) { |
| 978 | int leftBound, rightBound; |
| 979 | { |
| 980 | QMutexLocker k(&_imp->boundariesMutex); |
| 981 | leftBound = _imp->leftBoundary; |
| 982 | rightBound = _imp->rightBoundary; |
| 983 | } |
| 984 | int firstPos = toWidget(leftBound - 1); |
| 985 | int lastPos = toWidget(rightBound + 1); |
| 986 | int distFromFirst = std::abs(e->x() - firstPos); |
| 987 | int distFromLast = std::abs(e->x() - lastPos); |
| 988 | if (distFromFirst > distFromLast) { // moving last frame anchor |
| 989 | if (leftBound <= tseq) { |
| 990 | setBoundariesInternal(leftBound, tseq, true); |
| 991 | } |
| 992 | } else { // moving first frame anchor |
| 993 | if (rightBound >= tseq) { |
| 994 | setBoundariesInternal(tseq, rightBound, true); |
| 995 | } |
| 996 | } |
| 997 | distortViewPort = true; |
| 998 | _imp->alphaCursor = false; |
| 999 | } else { |
| 1000 | _imp->alphaCursor = true; |
| 1001 | } |
| 1002 | |
| 1003 | if (distortViewPort) { |
nothing calls this directly
no test coverage detected