MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / mouseMoveEvent

Method mouseMoveEvent

Gui/TimeLineGui.cpp:946–1017  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

944}
945
946void
947TimeLineGui::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) {

Callers

nothing calls this directly

Calls 12

getCurrentSettingsMethod · 0.80
isTripleSyncEnabledMethod · 0.80
floorFunction · 0.50
absFunction · 0.50
xMethod · 0.45
currentFrameMethod · 0.45
setDraftRenderEnabledMethod · 0.45
getAppMethod · 0.45
getNodeMethod · 0.45
onFrameChangedMethod · 0.45

Tested by

no test coverage detected