Fix scrollbar

This commit is contained in:
Henrique Santiago 2013-02-19 21:34:06 -03:00
parent e87e669c87
commit 6d456994f4
5 changed files with 31 additions and 19 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 661 B

After

Width:  |  Height:  |  Size: 646 B

View File

@ -5,6 +5,7 @@ locale = {
-- As traduções devem vir sempre em ordem alfabética.
translation = {
["%d of experience per hour"] = "%d de experiência por hora",
["%s of experience left"] = "%s de experiência faltando",
["%s: (use object on target)"] = "%s: (usar objeto no alvo)",
["%s: (use object on yourself)"] = "%s: (usar objeto em si)",
@ -221,6 +222,7 @@ locale = {
["Name Report + Banishment"] = "Reportar Nome + Banimento",
["Name Report"] = "Reportar Nome",
["Name"] = "Nome",
["Next level in %d hours and %d minutes"] = "Próximo nível em %d horas e %d minutos",
["No graphics card detected, everything will be drawn using the CPU,\nthus the performance will be really bad.\nPlease update your graphics driver to have a better performance."] = false,
["No item selected."] = "Nenhum item selecionado",
["No Mount"] = "Sem montaria",
@ -287,6 +289,7 @@ locale = {
["Select object"] = "Selecionar objeto",
["Select Outfit"] = "Selecionar Roupa",
["Select your language"] = "Selecione sua língua",
["Sell All"] = "Vender Todos",
["Sell Now"] = "Vender agora",
["Sell Offers"] = "Ofertas de venda",
["Sell"] = "Vender",

View File

@ -5,7 +5,7 @@ ScrollBarSlider < UIButton
image-source: /images/ui/scrollbar
image-clip: 0 26 13 13
image-border: 2
image-color: #ffffffbb
image-color: #ffffffff
$hover:
image-clip: 13 26 13 13
$pressed:
@ -14,6 +14,12 @@ ScrollBarSlider < UIButton
$disabled:
image-color: #ffffff66
ScrollBarValueLabel < Label
id: valueLabel
anchors.fill: parent
color: white
text-align: center
VerticalScrollBar < UIScrollBar
orientation: vertical
width: 13
@ -55,6 +61,8 @@ VerticalScrollBar < UIScrollBar
ScrollBarSlider
ScrollBarValueLabel
HorizontalScrollBar < UIScrollBar
orientation: horizontal
height: 13
@ -97,3 +105,5 @@ HorizontalScrollBar < UIScrollBar
image-color: #ffffff66
ScrollBarSlider
ScrollBarValueLabel

View File

@ -55,8 +55,9 @@ local function updateValueDisplay(widget)
if widget == nil then return end
if widget:getShowValue() then
local valueLabel = widget:getChildById('valueLabel')
local symbol = widget:getSymbol()
widget:setText(widget:getValue()..(symbol and symbol or ''))
valueLabel:setText(widget:getValue() .. (symbol or ''))
end
end
@ -172,6 +173,9 @@ end
function UIScrollBar:setMaximum(maximum)
if maximum == self.maximum then return end
self.maximum = maximum
if self.minimum > maximum then
self:setMinimum(maximum)
end
if self.value > maximum then
self:setValue(maximum)
else
@ -182,6 +186,9 @@ end
function UIScrollBar:setMinimum(minimum)
if minimum == self.minimum then return end
self.minimum = minimum
if self.maximum < minimum then
self:setMaximum(minimum)
end
if self.value < minimum then
self:setValue(minimum)
else

View File

@ -127,6 +127,10 @@ function onItemBoxChecked(widget)
selectedItem = item
refreshItem(item)
tradeButton:enable()
if getCurrentTradeType() == SELL then
quantityScroll:setValue(quantityScroll:getMaximum())
end
end
end
@ -225,7 +229,8 @@ function clearSelectedItem()
weightLabel:clearText()
priceLabel:clearText()
tradeButton:disable()
quantityScroll:setMaximum(1)
quantityScroll:setMinimum(0)
quantityScroll:setMaximum(0)
if selectedItem then
radioItems:selectWidget(nil)
selectedItem = nil
@ -293,22 +298,10 @@ function refreshItem(item)
end
local priceMaxCount = math.floor(playerMoney / getItemPrice(item, true))
local finalCount = math.max(0, math.min(getMaxAmount(), math.min(priceMaxCount, capacityMaxCount)))
quantityScroll:setMinimum(1)
quantityScroll:setMaximum(finalCount)
if quantityScroll:getValue() > finalCount then
quantityScroll:setValue(finalCount)
end
else
local removeAmount = 0
if ignoreEquipped:isChecked() then
local localPlayer = g_game.getLocalPlayer()
for i=1,LAST_INVENTORY do
local inventoryItem = localPlayer:getInventoryItem(i)
if inventoryItem and inventoryItem:getId() == item.ptr:getId() then
removeAmount = removeAmount + inventoryItem:getCount()
end
end
end
quantityScroll:setMinimum(1)
quantityScroll:setMaximum(math.max(0, math.min(getMaxAmount(), getSellQuantity(item.ptr))))
end
@ -481,7 +474,6 @@ function sellAll()
local amount = getSellQuantity(item)
if amount > 0 then
g_game.sellItem(item, amount, ignoreEquipped:isChecked())
print(amount)
end
end
end