Rotate view around the minifig center.

This commit is contained in:
Leonardo Zide 2020-12-23 18:45:34 -08:00
parent bcfbaa3080
commit 95bf7e43ff
2 changed files with 26 additions and 22 deletions

View file

@ -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()

View file

@ -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,8 +730,6 @@ void View::OnDraw()
mContext->SetLineWidth(1.0f);
if (mViewType == lcViewType::View)
{
if (Preferences.mDrawAxes)
DrawAxes();
@ -752,8 +750,8 @@ void View::OnDraw()
mViewSphere->Draw();
}
if (mWidget != nullptr)
DrawViewport();
}
mContext->ClearResources();
}