fix(3d): 异常绘制提示移右上角美化 + 线双击结束含双击位置
1) 操作提示从左上角(被工具条挡)移到右上角:深底+accent描边+右对齐+分行(标题/结束方式/取消), 按当前形态显示对应结束方式。 2) 线双击结束改为"含双击位置"(同地图工具):去掉之前的回滚——双击第一下的落点即为末顶点。 单/双击不再需要回滚隔离(双击第二下只 finish 不加点,无重复顶点)。
This commit is contained in:
parent
d7ab7705c9
commit
306d7bc46e
|
|
@ -51,26 +51,34 @@ void AnomalyDrawTool::start(DrawMode mode, const Vec3& planeOrigin, const Vec3&
|
|||
onFinish_ = std::move(onFinish);
|
||||
onCancel_ = std::move(onCancel);
|
||||
pts_.clear();
|
||||
ptsBeforeClick_.clear();
|
||||
lastClickMs_ = -1.0;
|
||||
hasCursor_ = false;
|
||||
active_ = true;
|
||||
installObservers();
|
||||
|
||||
// 屏幕操作提示(左上角),按形态给不同指引。
|
||||
// 屏幕操作提示(右上角,避开左侧工具条):标题 + 当前形态的结束方式 + 取消,分行排版。
|
||||
if (renderer_) {
|
||||
const char* tip =
|
||||
mode_ == DrawMode::Point
|
||||
? "标注点:左键单击落点即完成 · Esc 取消"
|
||||
? "标注点\n左键单击落点即完成\nEsc 取消"
|
||||
: (mode_ == DrawMode::Line
|
||||
? "标注线:左键逐点 · 双击完成 · Backspace 撤点 · Esc 取消"
|
||||
: "标注面:左键逐点 · 点回起点闭合 · Backspace 撤点 · Esc 取消");
|
||||
? "标注线\n左键逐点 · 双击结束\nBackspace 撤点 · Esc 取消"
|
||||
: "标注面\n左键逐点 · 点回起点闭合\nBackspace 撤点 · Esc 取消");
|
||||
hint_ = vtkSmartPointer<vtkTextActor>::New();
|
||||
hint_->SetInput(tip);
|
||||
hint_->GetTextProperty()->SetFontSize(16);
|
||||
hint_->GetTextProperty()->SetColor(1.0, 0.9, 0.0);
|
||||
auto* tp = hint_->GetTextProperty();
|
||||
tp->SetFontSize(15);
|
||||
tp->SetLineSpacing(1.3);
|
||||
tp->SetColor(0.90, 0.94, 1.0); // 近白(canvas-text)
|
||||
tp->SetJustificationToRight(); // 右对齐,贴右上
|
||||
tp->SetVerticalJustificationToTop();
|
||||
tp->SetBackgroundColor(0.04, 0.07, 0.12); // 深底
|
||||
tp->SetBackgroundOpacity(0.66);
|
||||
tp->SetFrame(1);
|
||||
tp->SetFrameColor(0.37, 0.55, 0.96); // accent 描边
|
||||
tp->SetFrameWidth(1);
|
||||
hint_->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
|
||||
hint_->GetPositionCoordinate()->SetValue(0.02, 0.94);
|
||||
hint_->GetPositionCoordinate()->SetValue(0.985, 0.975); // 右上角
|
||||
renderer_->AddViewProp(hint_);
|
||||
if (interactor_) interactor_->Render();
|
||||
}
|
||||
|
|
@ -282,12 +290,9 @@ void AnomalyDrawTool::installObservers() {
|
|||
self->lastClickX_ = p[0];
|
||||
self->lastClickY_ = p[1];
|
||||
if (dbl) {
|
||||
// 隔离单/双击:回滚"双击第一下"那次加点(否则线多一段、面多一条边),再完成。
|
||||
self->pts_ = self->ptsBeforeClick_;
|
||||
self->updatePreview();
|
||||
// 双击结束:第一下已落点(=双击位置),保留为末顶点直接完成(含双击位置,同地图工具)。
|
||||
self->finish();
|
||||
} else {
|
||||
self->ptsBeforeClick_ = self->pts_; // 快照本次点击前状态,供随后可能的双击回滚
|
||||
self->addVertex();
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ private:
|
|||
DrawMode mode_ = DrawMode::Face;
|
||||
Vec3 origin_{{0, 0, 0}}, normal_{{0, 0, 1}};
|
||||
std::vector<Vec3> pts_;
|
||||
std::vector<Vec3> ptsBeforeClick_; // 上一次单击前快照:双击时回滚"第一下"加点/移点,隔离单/双击
|
||||
std::function<void(const std::vector<Vec3>&)> onFinish_;
|
||||
std::function<void()> onCancel_;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue