void LadybugWidget::mousePressEvent(QMouseEvent* e) { if (NAVIGATION_RECT.contains(e->pos())) { // handle navigation navigationMousePress(e); } else { // handle images from cameras // we're interested only to right click - reset zoom if (e->button() != Qt::RightButton) return; for (int i = 0; i < CAMERAS; i++) { if (cameraRect(i).contains(e->pos())) { setCameraZoom(i, 1); if (mPaused) updateVideo(getSingleFrame(mCurrentFrame)); break; } } } }
void LadybugWidget::wheelEvent(QWheelEvent* e) { for (int cam = 0; cam < CAMERAS; cam++) { QRect r = cameraRect(cam); if (r.contains(e->pos())) { QPointF oldOffset; double oldZoom = cameraZoom(cam, &oldOffset); // negative = zoom in const double FACTOR = 1.25; double zoom = oldZoom * (e->delta() > 0 ? 1/FACTOR : FACTOR); if (zoom < 1) zoom = 1; if (zoom > 4) zoom = 4; if (zoom == oldZoom) return; QPointF pos = (e->pos()-r.topLeft())/oldZoom; QPointF newPos = pos * oldZoom/zoom; QPointF offset = oldOffset + pos - newPos; printf("delta %d | pos %.1f,%.1f | new_pos %.1f,%.1f | zoom %.2f | offset %.1f,%.1f\n", e->delta(), pos.x(),pos.y(), newPos.x(), newPos.y(), zoom, offset.x(), offset.y()); setCameraZoom(cam, zoom, offset); if (mPaused) updateVideo(getSingleFrame(mCurrentFrame)); break; } } }
void mouseMovement(int x, int y) { if (getMouseEvent() == MOVE) setCameraMovement(x,y); if (getMouseEvent() == ZOOM) setCameraZoom(x,y); }
void cbMouseMotion (int x, int y) { if (getMouseEvent() == MOVE) setCameraMovement(x,y); if (getMouseEvent() == ZOOM) setCameraZoom(x,y); setMouseCoord(x,y); }
void ClothAppConfig::load( ResConfigRegistryR& reg ) { BaseClass::load( reg ); setCameraRotate( readGeMatrix4( reg, CAMERA_ROTATE_NAME, CAMERA_ROTATE_DEFAULT ) ); setCameraZoom( reg.readFloat( CAMERA_ZOOM_NAME, CAMERA_ZOOM_DEFAULT ) ); setLightRotate( readGeMatrix4( reg, LIGHT_ROTATE_NAME, LIGHT_ROTATE_DEFAULT ) ); setFogStart( reg.readFloat( FOG_START_NAME, FOG_START_DEFAULT ) ); setFogEnd( reg.readFloat( FOG_END_NAME, FOG_END_DEFAULT ) ); }