vtkDistanceWidget bug
I am using VTK 8.1, in Windows 10 64 bit, VS2017 environment.
I have written the following code:
void CVTKDoc::CreateDistanceWidget(CVTKView* pView)
{
// Associate the widget with the render window interactor
vtkDistanceWidget* pDistanceWidget = vtkDistanceWidget::New();
pDistanceWidget->SetInteractor(pView->m_pInteractor);
// Create the default widget representation and set the label format
pDistanceWidget->CreateDefaultRepresentation();
static_cast<vtkDistanceRepresentation*>(pDistanceWidget->GetRepresentation())->SetLabelFormat(_T("%-#6.3g mm"));
// Allow the observer to access the widget
vtkCallbackCommand* pCallback = vtkCallbackCommand::New();
pCallback->SetClientData(pDistanceWidget);
pCallback->SetCallback(&CVTKDoc::DistanceWidgetCallback);
pDistanceWidget->GetInteractor()->AddObserver(vtkCommand::LeftButtonPressEvent, pCallback);
pDistanceWidget->On();
pCallback->Delete();
}
and the static method:
void CVTKDoc::DistanceWidgetCallback(vtkObject* caller, long unsigned int eventId, void* clientData, void* callData)
{
vtkDistanceWidget* pDistanceWidget = (vtkDistanceWidget*)clientData;
TRACE(_T("%d\t%p\n"), (static_cast<vtkRenderWindowInteractor*>(caller))->GetKeySym(), pDistanceWidget);
if (pDistanceWidget)
{
TRACE(_T("Good: clicked on the distance widget\n"));
}
else
{
TRACE(_T("Error: clicked something else\n"));
}
}
This is the image:
Now, EVERYWHERE I click on image, I see "Good: clicked on the distance widget" ... I mean, everywhere. Even if I put over the image another widget, let say text widget, and I click on that text widget, I see the same message from the distance widget. Which is not normal. That is why I reported a bug. Please correct me if I wrong.