MCPcopy Create free account
hub / github.com/Profactor/cv-plot / mouseEvent

Method mouseEvent

CvPlot/examples/examples_gui.cpp:193–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191 return getRect(mouseEvent.projection()).contains(mouseEvent.innerPoint());
192 }
193 bool mouseEvent(const MouseEvent &mouseEvent) {
194 if (mouseEvent.event() == cv::MouseEventTypes::EVENT_LBUTTONDOWN
195 && hitTest(mouseEvent)){
196 _dragging = true;
197 _dragOffset = mouseEvent.pos() - _point;
198 return true;
199 }
200 if (_dragging && mouseEvent.event() == cv::MouseEventTypes::EVENT_MOUSEMOVE) {
201 _point = cv::Vec2d(mouseEvent.pos()) - _dragOffset;
202 return true;
203 }
204 if (_dragging && mouseEvent.event() == cv::MouseEventTypes::EVENT_LBUTTONUP) {
205 _dragging = false;
206 return true;
207 }
208 return false;
209 };
210 };
211 Axes axes = makePlotAxes();
212 axes.setXLim({ 0,2 });

Callers 2

examples_gui.cppFile · 0.80
setMouseCallbackMethod · 0.80

Calls 2

eventMethod · 0.80
posMethod · 0.80

Tested by

no test coverage detected