Updated ImGui.

This commit is contained in:
Branimir Karadžić 2016-09-19 21:50:18 -07:00
parent 78773108c5
commit a365c861c9
3 changed files with 12 additions and 8 deletions

View File

@ -3361,8 +3361,7 @@ void ImGui::EndTooltip()
static bool IsPopupOpen(ImGuiID id)
{
ImGuiContext& g = *GImGui;
const bool is_open = g.OpenPopupStack.Size > g.CurrentPopupStack.Size && g.OpenPopupStack[g.CurrentPopupStack.Size].PopupId == id;
return is_open;
return g.OpenPopupStack.Size > g.CurrentPopupStack.Size && g.OpenPopupStack[g.CurrentPopupStack.Size].PopupId == id;
}
// Mark popup as open (toggle toward open state).
@ -9734,6 +9733,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
if (!ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, window->Active || window->WasActive, window))
return;
NodeDrawList(window->DrawList, "DrawList");
ImGui::BulletText("Pos: (%.1f,%.1f)", window->Pos.x, window->Pos.y);
ImGui::BulletText("Size: (%.1f,%.1f), SizeContents (%.1f,%.1f)", window->Size.x, window->Size.y, window->SizeContents.x, window->SizeContents.y);
ImGui::BulletText("Scroll: (%.2f,%.2f)", window->Scroll.x, window->Scroll.y);
if (window->RootWindow != window) NodeWindow(window->RootWindow, "RootWindow");

View File

@ -1843,7 +1843,7 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c
}
}
const float char_width = ((int)c < IndexXAdvance.Size) ? IndexXAdvance[(int)c] * scale : FallbackXAdvance;
const float char_width = ((int)c < IndexXAdvance.Size ? IndexXAdvance[(int)c] : FallbackXAdvance) * scale;
if (ImCharIsSpace(c))
{
if (inside_word)

View File

@ -914,7 +914,7 @@ namespace ImGuizmo
if (gContext.mbUsing)
{
// ImVec2 sourcePosOnScreen = worldToPos(gContext.mMatrixOrigin, gContext.mViewProjection);
//ImVec2 sourcePosOnScreen = worldToPos(gContext.mMatrixOrigin, gContext.mViewProjection);
ImVec2 destinationPosOnScreen = worldToPos(gContext.mModel.v.position, gContext.mViewProjection);
/*vec_t dif(destinationPosOnScreen.x - sourcePosOnScreen.x, destinationPosOnScreen.y - sourcePosOnScreen.y);
dif.Normalize();
@ -980,7 +980,7 @@ namespace ImGuizmo
{
ImVec2 sourcePosOnScreen = worldToPos(gContext.mMatrixOrigin, gContext.mViewProjection);
ImVec2 destinationPosOnScreen = worldToPos(gContext.mModel.v.position, gContext.mViewProjection);
vec_t dif = { destinationPosOnScreen.x - sourcePosOnScreen.x, destinationPosOnScreen.y - sourcePosOnScreen.y, 0.0f, 0.0f };
vec_t dif = { destinationPosOnScreen.x - sourcePosOnScreen.x, destinationPosOnScreen.y - sourcePosOnScreen.y, 0.f, 0.f };
dif.Normalize();
dif *= 5.f;
drawList->AddCircle(sourcePosOnScreen, 6.f, translationLineColor);
@ -1037,7 +1037,7 @@ namespace ImGuizmo
ImGuiIO& io = ImGui::GetIO();
int type = NONE;
vec_t deltaScreen = { io.MousePos.x - gContext.mScreenSquareCenter.x, io.MousePos.y - gContext.mScreenSquareCenter.y, 0.0f, 0.0f };
vec_t deltaScreen = { io.MousePos.x - gContext.mScreenSquareCenter.x, io.MousePos.y - gContext.mScreenSquareCenter.y, 0.f, 0.f };
float dist = deltaScreen.Length();
if (dist >= 0.058f * io.DisplaySize.x && dist < 0.062f * io.DisplaySize.x)
type = ROTATE_SCREEN;
@ -1133,9 +1133,13 @@ namespace ImGuizmo
vec_t cumulativeDelta = gContext.mModel.v.position + delta - gContext.mMatrixOrigin;
if (applyRotationLocaly)
{
cumulativeDelta.TransformVector(gContext.mModelSourceInverse);
matrix_t modelSourceNormalized = gContext.mModelSource;
modelSourceNormalized.OrthoNormalize();
matrix_t modelSourceNormalizedInverse;
modelSourceNormalizedInverse.Inverse(modelSourceNormalized);
cumulativeDelta.TransformVector(modelSourceNormalizedInverse);
ComputeSnap(cumulativeDelta, snap);
cumulativeDelta.TransformVector(gContext.mModelSource);
cumulativeDelta.TransformVector(modelSourceNormalized);
}
else
{