Skip to content
Snippets Groups Projects
Commit 1f71993e authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Correctly positioned mouse clicks

parent b4162f10
No related branches found
No related tags found
1 merge request!316Resolves #343 GUI and Frame Refactor
Pipeline #28180 failed
......@@ -138,9 +138,11 @@ CameraView::~CameraView() {
bool CameraView::mouseButtonEvent(const Eigen::Vector2i &p, int button, bool down, int modifiers) {
//LOG(INFO) << "mouseButtonEvent: " << p << " - " << button;
if (button == 0) {
// FIXME: Allow for zoom and offset of image...
ctrl_->touch(0, ftl::codecs::TouchType::MOUSE_LEFT, p.x()-mPos.x(), p.y()-mPos.y(), 0.0f);
if (button == 0 && !down) {
auto pos = imview_->imageCoordinateAt((p - mPos).cast<float>());
if (pos.x() >= 0.0f && pos.y() >= 0.0f) {
ctrl_->touch(0, ftl::codecs::TouchType::MOUSE_LEFT, pos.x(), pos.y(), 0.0f);
}
return true;
}
return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment