mirror of
https://github.com/leozide/leocad
synced 2025-02-05 08:45:55 +01:00
Rotate view around the minifig center.
This commit is contained in:
parent
bcfbaa3080
commit
95bf7e43ff
2 changed files with 26 additions and 22 deletions
|
@ -4442,6 +4442,8 @@ void lcModel::SetMinifig(const lcMinifig& Minifig)
|
|||
{
|
||||
DeleteModel();
|
||||
|
||||
lcArray<lcObject*> Pieces(LC_MFW_NUMITEMS);
|
||||
|
||||
for (int PartIdx = 0; PartIdx < LC_MFW_NUMITEMS; PartIdx++)
|
||||
{
|
||||
if (!Minifig.Parts[PartIdx])
|
||||
|
@ -4453,7 +4455,11 @@ void lcModel::SetMinifig(const lcMinifig& Minifig)
|
|||
Piece->SetColorIndex(Minifig.Colors[PartIdx]);
|
||||
AddPiece(Piece);
|
||||
Piece->UpdatePosition(1);
|
||||
|
||||
Pieces.Add(Piece);
|
||||
}
|
||||
|
||||
SetSelectionAndFocus(Pieces, nullptr, 0, false);
|
||||
}
|
||||
|
||||
void lcModel::UpdateInterface()
|
||||
|
|
|
@ -611,7 +611,7 @@ void View::OnDraw()
|
|||
return;
|
||||
|
||||
const lcPreferences& Preferences = lcGetPreferences();
|
||||
const bool DrawInterface = mWidget != nullptr;
|
||||
const bool DrawInterface = mWidget != nullptr && mViewType == lcViewType::View;
|
||||
|
||||
mScene->SetAllowLOD(Preferences.mAllowLOD && mWidget != nullptr);
|
||||
mScene->SetLODDistance(Preferences.mMeshLODDistance);
|
||||
|
@ -638,7 +638,7 @@ void View::OnDraw()
|
|||
}
|
||||
}
|
||||
|
||||
if (DrawInterface && mViewType == lcViewType::View)
|
||||
if (DrawInterface)
|
||||
mScene->SetPreTranslucentCallback([this]() { DrawGrid(); });
|
||||
|
||||
mScene->End();
|
||||
|
@ -730,31 +730,29 @@ void View::OnDraw()
|
|||
|
||||
mContext->SetLineWidth(1.0f);
|
||||
|
||||
if (mViewType == lcViewType::View)
|
||||
{
|
||||
if (Preferences.mDrawAxes)
|
||||
DrawAxes();
|
||||
if (Preferences.mDrawAxes)
|
||||
DrawAxes();
|
||||
|
||||
lcTool Tool = gMainWindow->GetTool();
|
||||
lcModel* ActiveModel = GetActiveModel();
|
||||
lcTool Tool = gMainWindow->GetTool();
|
||||
lcModel* ActiveModel = GetActiveModel();
|
||||
|
||||
if ((Tool == lcTool::Select || Tool == lcTool::Move) && mTrackButton == lcTrackButton::None && ActiveModel->AnyObjectsSelected())
|
||||
DrawSelectMoveOverlay();
|
||||
else if (GetCurrentTool() == lcTool::Move && mTrackButton != lcTrackButton::None)
|
||||
DrawSelectMoveOverlay();
|
||||
else if ((Tool == lcTool::Rotate || (Tool == lcTool::Select && mTrackButton != lcTrackButton::None && mTrackTool >= lcTrackTool::RotateX && mTrackTool <= lcTrackTool::RotateXYZ)) && ActiveModel->AnyPiecesSelected())
|
||||
DrawRotateOverlay();
|
||||
else if ((mTrackTool == lcTrackTool::Select || mTrackTool == lcTrackTool::ZoomRegion) && mTrackButton != lcTrackButton::None)
|
||||
DrawSelectZoomRegionOverlay();
|
||||
else if (Tool == lcTool::RotateView && mTrackButton == lcTrackButton::None)
|
||||
DrawRotateViewOverlay();
|
||||
if ((Tool == lcTool::Select || Tool == lcTool::Move) && mTrackButton == lcTrackButton::None && ActiveModel->AnyObjectsSelected())
|
||||
DrawSelectMoveOverlay();
|
||||
else if (GetCurrentTool() == lcTool::Move && mTrackButton != lcTrackButton::None)
|
||||
DrawSelectMoveOverlay();
|
||||
else if ((Tool == lcTool::Rotate || (Tool == lcTool::Select && mTrackButton != lcTrackButton::None && mTrackTool >= lcTrackTool::RotateX && mTrackTool <= lcTrackTool::RotateXYZ)) && ActiveModel->AnyPiecesSelected())
|
||||
DrawRotateOverlay();
|
||||
else if ((mTrackTool == lcTrackTool::Select || mTrackTool == lcTrackTool::ZoomRegion) && mTrackButton != lcTrackButton::None)
|
||||
DrawSelectZoomRegionOverlay();
|
||||
else if (Tool == lcTool::RotateView && mTrackButton == lcTrackButton::None)
|
||||
DrawRotateViewOverlay();
|
||||
|
||||
mViewSphere->Draw();
|
||||
}
|
||||
|
||||
DrawViewport();
|
||||
mViewSphere->Draw();
|
||||
}
|
||||
|
||||
if (mWidget != nullptr)
|
||||
DrawViewport();
|
||||
|
||||
mContext->ClearResources();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue