Fix AngleAnnotationActor & TextAnnotationActor highlight disable bug.

This commit is contained in:
Krad
2022-11-24 14:07:03 +08:00
parent 741f3210fb
commit e8d503cdd0
3 changed files with 18 additions and 1 deletions

View File

@@ -110,6 +110,9 @@ void AngleAnnotationActor::BuildShape() {
}
void AngleAnnotationActor::Highlight(int highlightOn) {
bool temp = highlightOn > 0;
if (temp == this->Highlighted) return;
this->Highlighted = temp;
if (this->Highlighted) {
actor2D->GetProperty()->SetColor(1.0, 1.0, 0.0);
textProperty->SetColor(1.0, 1.0, 0.0);

View File

@@ -59,7 +59,7 @@ void TextAnnotationActor::ResetTextProp() {
mTextProperty->SetFrame(false);
//textProperty->SetFrameColor(1.0, 0.0, 0.0);
mTextProperty->SetBackgroundColor(1.0, 0.0, 0.0);
mTextProperty->SetBackgroundOpacity(0.3);
mTextProperty->SetBackgroundOpacity(0.0);
}
TextAnnotationActor::TextAnnotationActor() {
@@ -148,3 +148,15 @@ bool TextAnnotationActor::onMeasureLeftButtonUp(vtkRenderWindowInteractor *iren)
mIren = iren;
return false;
}
void TextAnnotationActor::RenderWithState() {
if (this->Highlighted) {
mTextProperty->SetBackgroundRGBA(1.0, 1.0, 0.0,0.2);
return;
}
if (this->Selected) {
mTextProperty->SetBackgroundRGBA(1.0, 0.0, 0.0,0.2);
return;
}
mTextProperty->SetBackgroundRGBA(1.0, 1.0, 0.0,0.0);
}

View File

@@ -54,6 +54,8 @@ vtkTypeMacro(TextAnnotationActor, DraggableActor);
SetWorldPosition2(pos[0], pos[1], pos[2]);
}
void RenderWithState();
bool onMeasureLeftButtonDown(vtkRenderWindowInteractor *) override;
void onMeasureMouseMove(vtkRenderWindowInteractor *) override;