bool PixelOrientedViewNavigator::eventFilter(QObject *widget, QEvent *e) { if(e->type() != QEvent::MouseButtonDblClick && e->type() != QEvent::MouseMove) return false; GlMainWidget *glWidget = (GlMainWidget *) widget; if (!glWidget->hasMouseTracking()) { glWidget->setMouseTracking(true); } if (!pixelView->smallMultiplesViewSet() && !pixelView->interactorsEnabled()) { pixelView->toggleInteractors(true); } if (pixelView->getOverviews().size() == 0) { return false; } if (e->type() == QEvent::MouseMove && pixelView->smallMultiplesViewSet()) { QMouseEvent *me = (QMouseEvent *) e; int x = glWidget->width() - me->x(); int y = me->y(); Coord screenCoords(x, y, 0); Coord sceneCoords = glWidget->getScene()->getGraphCamera().viewportTo3DWorld(glWidget->screenToViewport(screenCoords)); PixelOrientedOverview *overviewUnderPointer = getOverviewUnderPointer(sceneCoords); if (overviewUnderPointer != NULL && overviewUnderPointer != selectedOverview) { selectedOverview = overviewUnderPointer; } return true; } else if (e->type() == QEvent::MouseButtonDblClick) { if (selectedOverview != NULL && !selectedOverview->overviewGenerated()) { pixelView->generatePixelOverview(selectedOverview, glWidget); glWidget->draw(); } else if (selectedOverview != NULL && pixelView->smallMultiplesViewSet()) { QtGlSceneZoomAndPanAnimator zoomAndPanAnimator(glWidget, selectedOverview->getBoundingBox()); zoomAndPanAnimator.animateZoomAndPan(); pixelView->switchFromSmallMultiplesToDetailView(selectedOverview); selectedOverview = NULL; } else if (!pixelView->smallMultiplesViewSet() && pixelView->getOverviews().size() > 1) { pixelView->switchFromDetailViewToSmallMultiples(); QtGlSceneZoomAndPanAnimator zoomAndPanAnimator(glWidget, pixelView->getSmallMultiplesViewBoundingBox()); zoomAndPanAnimator.animateZoomAndPan(); pixelView->centerView(); } return true; } return false; }
void FishEyeInteractorComponent::viewChanged(View *view) { if (view == nullptr) { return; } GlMainView *glView = static_cast<GlMainView *>(view); GlMainWidget *glWidget = glView->getGlMainWidget(); if (!glWidget->hasMouseTracking()) { glWidget->setMouseTracking(true); } if (configWidget->getFishEyeRadius() == 0.) { configWidget->setFishEyeRadius(glWidget->getScene()->getGraphCamera().getSceneRadius() / 4.); configWidget->setFishEyeHeight(4.); } }