Dear all,
I am trying to put a text around a object all in 2d. But i found that this widget when i move the camera (or zoom in an area) the objects moves correctly but the text widget stays and is not accordingly updated. The same problem happens with other widgets such as the seed widgets. I wonder how i can enable this text widget so that it gets correctly positioned when the camera moves. Thanks
textActor->SetInput(stream.c_str());
//textActor->SetTextScaleModeToNone();
textActor->SetTextScaleModeToProp();
textActor->GetTextProperty()->SetFontSize(90);
textActor->GetTextProperty()->SetColor(1.0, 0.0, 0.0);
vtkNew<vtkTextProperty> text_prop;
text_prop->SetFontSize(20);
text_prop->SetColor(0, 1, 0);
textActor->SetTextProperty(text_prop);
vtkNew<vtkTextWidget> textWidget;
vtkSmartPointer<vtkTextRepresentation> textRepresentation =
vtkSmartPointer<vtkTextRepresentation>::New();
textRepresentation->GetPositionCoordinate()->SetCoordinateSystemToWorld();
//double mouse_click_pos1[3] = { roi.xmin, roi.ymin, roi.z };
textRepresentation->GetPositionCoordinate()->SetValue(mouse_click_pos);
textWidget->SetRepresentation(textRepresentation);
textWidget->SetInteractor(interactor);
textWidget->SetTextActor(textActor);
textWidget->SelectableOff();
textWidget->On();