This function is called by the event handling system everytime the user has moved or clicked the mouse. So if you want a window which reacts to the mouse in a specific way, you can inherit a class from Window. Another method to implement mouse behaviour is to use a window listener (in this case you have to inherit a class from WindowListener and attach it to this window, see WindowListener for more details) Reimplemented from OglGui::Window. Definition at line 109 of file ViewerPointCloudNavigator.h. References OglGui::OglWindow::H(), mMaxX, mMaxY, mMinX, mMinY, OglGui::Window::MouseFunc(), mViewerPointCloud, OglGui::ViewerPointCloud::Scale(), OglGui::ViewerPointCloud::SetPtDocXY(), ToViewerPointCloudMouse(), and OglGui::OglWindow::W(). 00110 { 00111 static bool isDragging = false; 00112 static int lastX; 00113 00114 Window::MouseFunc(msg, btn, state, x, y); 00115 if (msg == oglMouseDown && btn == oglRightButton) 00116 { 00117 isDragging = true; 00118 lastX = x; 00119 } 00120 00121 if (msg == oglMouseUp) 00122 isDragging = false; 00123 00124 if (!isDragging) 00125 { 00126 ToViewerPointCloudMouse(msg, btn, state, x, y); 00127 return; 00128 } 00129 00130 if (state&oglShift) 00131 { 00132 float scale = mViewerPointCloud->Scale(); 00133 mViewerPointCloud->Scale(scale * (1.f+((x - lastX)/50.f))); 00134 } 00135 else 00136 { 00137 float vpcW = mViewerPointCloud->W(); 00138 float vpcH = mViewerPointCloud->H(); 00139 float xFact = x / (float) W(); 00140 float yFact = y / (float) H(); 00141 float pX = (vpcW/2) - (mMinX+(xFact * (mMaxX-mMinX))); 00142 float pY = (vpcH/2) - (mMinY+(yFact * (mMaxY-mMinY))); 00143 mViewerPointCloud->SetPtDocXY(pX, pY); 00144 } 00145 lastX = x; 00146 }
Here is the call graph for this function:
|