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

Method OnLeftButtonDown

Interaction/Widgets/vtkLineWidget.cxx:589–643  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

587
588//------------------------------------------------------------------------------
589void vtkLineWidget::OnLeftButtonDown()
590{
591 int forward = 0;
592
593 int X = this->Interactor->GetEventPosition()[0];
594 int Y = this->Interactor->GetEventPosition()[1];
595
596 // Okay, make sure that the pick is in the current renderer
597 if (!this->CurrentRenderer || !this->CurrentRenderer->IsInViewport(X, Y))
598 {
599 this->State = vtkLineWidget::Outside;
600 return;
601 }
602
603 // Okay, we can process this. Try to pick handles first;
604 // if no handles picked, then try to pick the line.
605 vtkAssemblyPath* path = this->GetAssemblyPath(X, Y, 0., this->HandlePicker);
606
607 if (path != nullptr)
608 {
609 this->EventCallbackCommand->SetAbortFlag(1);
610 this->StartInteraction();
611 this->InvokeEvent(vtkCommand::StartInteractionEvent, nullptr);
612 this->State = vtkLineWidget::MovingHandle;
613 this->HighlightHandle(path->GetFirstNode()->GetViewProp());
614 this->EnablePointWidget();
615 forward = this->ForwardEvent(vtkCommand::LeftButtonPressEvent);
616 }
617 else
618 {
619 path = this->GetAssemblyPath(X, Y, 0., this->LinePicker);
620
621 if (path != nullptr)
622 {
623 this->EventCallbackCommand->SetAbortFlag(1);
624 this->StartInteraction();
625 this->InvokeEvent(vtkCommand::StartInteractionEvent, nullptr);
626 this->State = vtkLineWidget::MovingLine;
627 this->HighlightLine(1);
628 this->EnablePointWidget();
629 forward = this->ForwardEvent(vtkCommand::LeftButtonPressEvent);
630 }
631 else
632 {
633 this->State = vtkLineWidget::Outside;
634 this->HighlightHandle(nullptr);
635 return;
636 }
637 }
638
639 if (!forward)
640 {
641 this->Interactor->Render();
642 }
643}
644
645//------------------------------------------------------------------------------
646void vtkLineWidget::OnLeftButtonUp()

Callers 1

ProcessEventsMethod · 0.95

Calls 11

HighlightHandleMethod · 0.95
EnablePointWidgetMethod · 0.95
ForwardEventMethod · 0.95
HighlightLineMethod · 0.95
IsInViewportMethod · 0.80
InvokeEventMethod · 0.80
GetFirstNodeMethod · 0.80
RenderMethod · 0.65
GetAssemblyPathMethod · 0.45
StartInteractionMethod · 0.45
GetViewPropMethod · 0.45

Tested by

no test coverage detected