1
0
forked from 0ad/0ad

Fix scrollbare edgy-case and off by 1's in dropdown

Reviewed By: Imarok
Comments By: elexis
Differential Revision: https://code.wildfiregames.com/D1030
This was SVN commit r20500.
This commit is contained in:
bb 2017-11-21 20:07:23 +00:00
parent 2fa4457453
commit e6dff349bd
3 changed files with 6 additions and 6 deletions

View File

@ -76,7 +76,7 @@
sprite2_disabled="ModernDropDownArrowDisabled"
sprite2_pressed="ModernDropDownArrowHighlight"
buffer_zone="8"
dropdown_size="224"
dropdown_size="225"
sprite_list="BlackBorderOnGray"
sprite_selectarea="ModernDarkBoxWhite"
textcolor_selected="white"

View File

@ -393,7 +393,7 @@ void CDropDown::SetupListRect()
GUI<float>::GetSetting(this, "dropdown_size", size);
GUI<float>::GetSetting(this, "dropdown_buffer", buffer);
if (m_ItemsYPositions.empty() || m_ItemsYPositions.back() >= size)
if (m_ItemsYPositions.empty() || m_ItemsYPositions.back() > size)
{
m_CachedListRect = CRect(m_CachedActualSize.left, m_CachedActualSize.bottom+buffer,
m_CachedActualSize.right, m_CachedActualSize.bottom+buffer + size);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2015 Wildfire Games.
/* Copyright (C) 2017 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -207,12 +207,12 @@ public:
/**
* Get the value of m_Pos that corresponds to the bottom of the scrollable region
*/
float GetMaxPos() const { return std::max(1.f, m_ScrollRange - m_ScrollSpace); }
float GetMaxPos() const { return std::max(0.f, m_ScrollRange - m_ScrollSpace); }
/**
* Get the value of m_Pos that corresponds to the bottom of the scrollable region
* Scrollbars without height shouldn't be visible
*/
float IsVisible() const { return GetMaxPos() != 1.f; }
bool IsVisible() const { return GetMaxPos() != 0.f; }
/**
* Increase scroll one step