From a35f7c73ae0679acea383eab14628b4713453d18 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 28 Apr 2014 18:40:29 +0200 Subject: [PATCH] Fixes #1286 (Dialogue topic list clips with window frame) The first problem was with the ScrollView skin, which had a full-sized client area. Since the scrollbar starts out visible, MyGUI expects the client area to be smaller to accomodate for the scrollbar width. As a result, the starting canvas size becomes bigger than the view size. Another bug was with the MWList code: reducing the canvas size for the scrollbar is not needed, since MyGUI is already doing that, and attempting to do it manually interferes with the view offset. --- apps/openmw/mwgui/list.cpp | 6 +++--- files/mygui/openmw_scroll_skin.xml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwgui/list.cpp b/apps/openmw/mwgui/list.cpp index 8dda041ca6..eff7aea248 100644 --- a/apps/openmw/mwgui/list.cpp +++ b/apps/openmw/mwgui/list.cpp @@ -48,7 +48,7 @@ namespace MWGui void MWList::redraw(bool scrollbarShown) { - const int _scrollBarWidth = 24; // fetch this from skin? + const int _scrollBarWidth = 20; // fetch this from skin? const int scrollBarWidth = scrollbarShown ? _scrollBarWidth : 0; const int spacing = 3; size_t scrollbarPosition = mScrollView->getScrollPosition(); @@ -83,7 +83,7 @@ namespace MWGui else { MyGUI::ImageBox* separator = mScrollView->createWidget("MW_HLine", - MyGUI::IntCoord(2, mItemHeight, mScrollView->getWidth()-4, 18), + MyGUI::IntCoord(2, mItemHeight, mScrollView->getWidth() - scrollBarWidth - 4, 18), MyGUI::Align::Left | MyGUI::Align::Top | MyGUI::Align::HStretch); separator->setNeedMouseFocus(false); @@ -91,7 +91,7 @@ namespace MWGui } ++i; } - mScrollView->setCanvasSize(mClient->getSize().width + (_scrollBarWidth-scrollBarWidth), std::max(mItemHeight, mClient->getSize().height)); + mScrollView->setCanvasSize(mClient->getSize().width, std::max(mItemHeight, mClient->getSize().height)); if (!scrollbarShown && mItemHeight > mClient->getSize().height) redraw(true); diff --git a/files/mygui/openmw_scroll_skin.xml b/files/mygui/openmw_scroll_skin.xml index b6ed9155f1..b5dfd333dd 100644 --- a/files/mygui/openmw_scroll_skin.xml +++ b/files/mygui/openmw_scroll_skin.xml @@ -3,12 +3,12 @@ - + - +