From 4957d233222ad74e418d07bf99ab80aa4bbfbd8a Mon Sep 17 00:00:00 2001 From: Dario Manesku Date: Sat, 5 Jul 2014 04:33:00 +0100 Subject: [PATCH] Added other alignment options for imguiImage(). --- examples/common/imgui/imgui.cpp | 10 +++++++++- examples/common/imgui/imgui.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/common/imgui/imgui.cpp b/examples/common/imgui/imgui.cpp index b89224498..58a91edc6 100644 --- a/examples/common/imgui/imgui.cpp +++ b/examples/common/imgui/imgui.cpp @@ -869,6 +869,10 @@ struct Imgui { int32_t xx; if (ImguiImageAlign::Left == _align) + { + xx = m_scrollAreaX + SCROLL_AREA_PADDING; + } + else if (ImguiImageAlign::LeftIndented == _align) { xx = m_widgetX; } @@ -876,10 +880,14 @@ struct Imgui { xx = m_scrollAreaX + (m_scrollAreaInnerWidth-_width)/2; } - else //if (ImguiImageAlign::CenterIndented == _align). + else if (ImguiImageAlign::CenterIndented == _align) { xx = (m_widgetX + m_scrollAreaInnerWidth + m_scrollAreaX - _width)/2; } + else //if (ImguiImageAlign::Right == _align). + { + xx = m_scrollAreaX + m_scrollAreaInnerWidth - _width; + } const int32_t yy = m_widgetY; m_widgetY += _height + DEFAULT_SPACING; diff --git a/examples/common/imgui/imgui.h b/examples/common/imgui/imgui.h index 332e2d977..75d7372f9 100644 --- a/examples/common/imgui/imgui.h +++ b/examples/common/imgui/imgui.h @@ -46,8 +46,10 @@ struct ImguiImageAlign enum Enum { Left, + LeftIndented, Center, CenterIndented, + Right, }; };