| 942 | } |
| 943 | |
| 944 | void Viewport::onLogicMouseRelease(QMouseEvent *event) |
| 945 | { |
| 946 | bool quickScroll = AppConfig::Instance().appOptions.quickScroll; |
| 947 | bool isMaxWindow = AppControl::Instance()->TopWindowIsMaximized(); |
| 948 | |
| 949 | switch (_action_type) |
| 950 | { |
| 951 | case NO_ACTION: |
| 952 | { |
| 953 | if (event->button() == Qt::LeftButton && _view.session().is_stopped_status()){ |
| 954 | //priority 1 |
| 955 | //try to quick scroll view... |
| 956 | int curX = event->pos().x(); |
| 957 | int clickX = _mouse_down_point.x(); |
| 958 | int moveLong = ABS_VAL(curX - clickX); |
| 959 | int maxWidth = this->geometry().width(); |
| 960 | float mvk = (float) moveLong / (float)maxWidth; |
| 961 | |
| 962 | if (quickScroll){ |
| 963 | quickScroll = false; |
| 964 | if (isMaxWindow && mvk > 0.4f){ |
| 965 | quickScroll = true; |
| 966 | } |
| 967 | else if (!isMaxWindow && mvk > 0.25f){ |
| 968 | quickScroll = true; |
| 969 | } |
| 970 | } |
| 971 | |
| 972 | if (_action_type == NO_ACTION && quickScroll) { |
| 973 | const double strength = _drag_strength*DragTimerInterval*1.0/_elapsed_time.elapsed(); |
| 974 | if (_elapsed_time.elapsed() < 200 && |
| 975 | abs(_drag_strength) < MinorDragOffsetUp && |
| 976 | abs(strength) > MinorDragRateUp) { |
| 977 | _drag_timer.start(DragTimerInterval); |
| 978 | set_action(LOGIC_MOVE); |
| 979 | } |
| 980 | else if (_elapsed_time.elapsed() < 200 && |
| 981 | abs(strength) > DragTimerInterval) { |
| 982 | _drag_strength = strength * 5; |
| 983 | _drag_timer.start(DragTimerInterval); |
| 984 | set_action(LOGIC_MOVE); |
| 985 | } |
| 986 | } |
| 987 | |
| 988 | // priority 2 |
| 989 | if (_action_type == NO_ACTION) { |
| 990 | if (_mouse_down_point.x() == event->pos().x()) { |
| 991 | const auto &sigs = _view.session().get_signals(); |
| 992 | |
| 993 | for(auto s : sigs) { |
| 994 | if (s->signal_type() == SR_CHANNEL_LOGIC) { |
| 995 | view::LogicSignal *logicSig = (view::LogicSignal*)s; |
| 996 | if (logicSig->is_by_edge(event->pos(), _edge_start, 10)) { |
| 997 | set_action(LOGIC_JUMP); |
| 998 | _cur_preX = _view.index2pixel(_edge_start); |
| 999 | _cur_preY = logicSig->get_y(); |
| 1000 | _cur_preY_top = logicSig->get_y() - logicSig->get_totalHeight()/2 - 12; |
| 1001 | _cur_preY_bottom = logicSig->get_y() + logicSig->get_totalHeight()/2 + 2; |
nothing calls this directly
no test coverage detected