MCPcopy Create free account
hub / github.com/Kitware/VTK / OnLeftButtonDown

Method OnLeftButtonDown

Interaction/Widgets/vtkSphereWidget.cxx:363–404  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

361
362//------------------------------------------------------------------------------
363void vtkSphereWidget::OnLeftButtonDown()
364{
365 if (!this->Interactor)
366 {
367 return;
368 }
369
370 int X = this->Interactor->GetEventPosition()[0];
371 int Y = this->Interactor->GetEventPosition()[1];
372
373 // Okay, make sure that the pick is in the current renderer
374 if (!this->CurrentRenderer || !this->CurrentRenderer->IsInViewport(X, Y))
375 {
376 this->State = vtkSphereWidget::Outside;
377 return;
378 }
379
380 // Okay, we can process this. Try to pick handles first;
381 // if no handles picked, then try to pick the sphere.
382 vtkAssemblyPath* path = this->GetAssemblyPath(X, Y, 0., this->Picker);
383
384 if (path == nullptr)
385 {
386 this->State = vtkSphereWidget::Outside;
387 return;
388 }
389 else if (path->GetFirstNode()->GetViewProp() == this->SphereActor)
390 {
391 this->State = vtkSphereWidget::Moving;
392 this->HighlightSphere(1);
393 }
394 else if (path->GetFirstNode()->GetViewProp() == this->HandleActor)
395 {
396 this->State = vtkSphereWidget::Positioning;
397 this->HighlightHandle(1);
398 }
399
400 this->EventCallbackCommand->SetAbortFlag(1);
401 this->StartInteraction();
402 this->InvokeEvent(vtkCommand::StartInteractionEvent, nullptr);
403 this->Interactor->Render();
404}
405
406//------------------------------------------------------------------------------
407void vtkSphereWidget::OnMouseMove()

Callers 1

ProcessEventsMethod · 0.95

Calls 9

HighlightSphereMethod · 0.95
HighlightHandleMethod · 0.95
IsInViewportMethod · 0.80
GetFirstNodeMethod · 0.80
InvokeEventMethod · 0.80
RenderMethod · 0.65
GetAssemblyPathMethod · 0.45
GetViewPropMethod · 0.45
StartInteractionMethod · 0.45

Tested by

no test coverage detected