void TransFuncIntensityGradientPainter::mouseMoveEvent(tgt::MouseEvent* event) { event->accept(); tgt::ivec2 size = getCanvas()->getSize(); tgt::vec2 pos = tgt::vec2( static_cast<float>(event->x()) / size.x, 1.f-static_cast<float>(event->y()) / size.y); tgt::vec2 offset = pos - mouseCoord_; if (selectedPrimitive_) { if (!dragging_) { emit toggleInteractionMode(true); dragging_ = true; } // test whether the movement is correct /*bool inside = */selectedPrimitive_->move(offset); // one or more control points are moved outside of the canvas // -> do not allow movement and reset mouse cursor to position before movement //if (!inside) { //tgt::QtCanvas* canvas = static_cast<tgt::QtCanvas*>(getCanvas()); //QPoint p(static_cast<int>(mouseCoord_.x * size.x), //static_cast<int>((1.f - mouseCoord_.y) * size.y)); //p = canvas->mapToGlobal(p); //QCursor::setPos(p); //} //else { mouseCoord_ = pos; updateTF(); //} } getCanvas()->update(); }
void TransFuncIntensityGradientPainter::mouseReleaseEvent(tgt::MouseEvent* event) { event->accept(); if (selectedPrimitive_ && dragging_) { dragging_ = false; emit toggleInteractionMode(false); } }
void DoubleSlider::mousePressEvent(QMouseEvent* e) { e->accept(); //calculate which marker is nearest to mouse position normalizedMousePos_ = static_cast<float>((e->pos()).x()-leftOffset_) / static_cast<float>(width()-leftOffset_-rightOffset_); mV1_ = minValue_; mV2_ = maxValue_; if (e->button() == Qt::LeftButton) { if (fabs(minValue_ - normalizedMousePos_) < fabs(maxValue_ - normalizedMousePos_)) { leftSliderActive_ = true; rightSliderActive_ = false; } else { leftSliderActive_ = false; rightSliderActive_ = true; } } else if (e->button() == Qt::RightButton) { leftSliderActive_ = true; rightSliderActive_ = true; } moveSlider(normalizedMousePos_); emit toggleInteractionMode(true); }
void TransFunc1DRampEditor::stopTracking() { toggleInteractionMode(false); }
void TransFunc1DRampEditor::startTracking() { toggleInteractionMode(true); }
void DoubleSlider::mouseReleaseEvent(QMouseEvent* e) { e->accept(); emit toggleInteractionMode(false); }
void ColorLuminancePicker::mouseReleaseEvent(QMouseEvent* event) { event->accept(); emit toggleInteractionMode(false); }
void ColorLuminancePicker::mousePressEvent(QMouseEvent* event) { emit toggleInteractionMode(true); setVal(y2val(event->y())); }
void TransFuncEditorIntensityRamp::stopTracking() { toggleInteractionMode(false); }
void TransFuncEditorIntensityRamp::startTracking() { toggleInteractionMode(true); }