More fixes to miniwindow

master
Henrique Santiago 12 년 전
부모 f27f005757
커밋 8d89d1194a

@ -66,7 +66,7 @@ function UIMiniWindow:maximize(dontSave)
signalcall(self.onMaximize, self)
end
function UIMiniWindow:onSetup()
function UIMiniWindow:setup()
self:getChildById('closeButton').onClick =
function()
self:close()
@ -126,16 +126,11 @@ function UIMiniWindow:onSetup()
end
end
if newParent and newParent:getClassName() == 'UIMiniWindowContainer' and self:isVisible() then
newParent:fitAll(self)
end
self:fitOnParent()
end
function UIMiniWindow:onVisibilityChange(visible)
local parent = self:getParent()
if visible and parent and parent:getClassName() == 'UIMiniWindowContainer' then
parent:fitAll(self)
end
self:fitOnParent()
end
function UIMiniWindow:onDragEnter(mousePos)
@ -227,11 +222,7 @@ end
function UIMiniWindow:onHeightChange(height)
self:setSettings({height = height})
local parent = self:getParent()
if self:isVisible() and parent and parent:getClassName() == 'UIMiniWindowContainer' then
parent:fitAll(self)
end
self:fitOnParent()
end
function UIMiniWindow:getSettings(name)
@ -295,6 +286,24 @@ function UIMiniWindow:disableResize()
self:getChildById('bottomResizeBorder'):disable()
end
function UIMiniWindow:fitOnParent()
local parent = self:getParent()
if self:isVisible() and parent and parent:getClassName() == 'UIMiniWindowContainer' then
parent:fitAll(self)
end
end
function UIMiniWindow:setParent(parent)
UIWidget.setParent(self, parent)
self:saveParent(parent)
self:fitOnParent()
end
function UIMiniWindow:setHeight(height)
UIWidget.setHeight(self, height)
signalcall(self.onHeightChange, self, height)
end
function UIMiniWindow:setContentHeight(height)
local contentsPanel = self:getChildById('contentsPanel')
local minHeight = contentsPanel:getMarginTop() + contentsPanel:getMarginBottom() + contentsPanel:getPaddingTop() + contentsPanel:getPaddingBottom()
@ -328,3 +337,8 @@ function UIMiniWindow:getMaximumHeight()
local resizeBorder = self:getChildById('bottomResizeBorder')
return resizeBorder:getMaximum()
end
function UIMiniWindow:isResizeable()
local resizeBorder = self:getChildById('bottomResizeBorder')
return resizeBorder:isVisible() and resizeBorder:isEnabled()
end

@ -35,7 +35,7 @@ function UIMiniWindowContainer:fitAll(noRemoveChild)
-- try to resize noRemoveChild
local maximumHeight = selfHeight - (sumHeight - noRemoveChild:getHeight())
if noRemoveChild:getMinimumHeight() <= maximumHeight then
if noRemoveChild:isResizeable() and noRemoveChild:getMinimumHeight() <= maximumHeight then
sumHeight = sumHeight - noRemoveChild:getHeight() + maximumHeight
addEvent(function() noRemoveChild:setHeight(maximumHeight) end)
end

@ -48,12 +48,10 @@ function UIResizeBorder:onMouseMove(mousePos, mouseMoved)
local delta = mousePos.y - self:getY() - self:getHeight()/2
newSize = math.min(math.max(parent:getHeight() + delta, self.minimum), self.maximum)
parent:setHeight(newSize)
signalcall(parent.onHeightChange, parent, newSize)
else
local delta = mousePos.x - self:getX() - self:getWidth()/2
newSize = math.min(math.max(parent:getWidth() + delta, self.minimum), self.maximum)
parent:setWidth(newSize)
signalcall(parent.onWidthChange, parent, newSize)
end
self:checkBoundary(newSize)

@ -65,6 +65,7 @@ function init()
onGameEnd = removeAllCreatures } )
checkCreatures()
battleWindow:setup()
end
function terminate()

@ -40,6 +40,8 @@ function init()
if g_game.isOnline() then
online()
end
combatControlsWindow:setup()
end
function terminate()

@ -98,6 +98,8 @@ function onContainerOpen(container, previousContainer)
local filledLines = math.max(math.ceil(container:getItemsCount() / layout:getNumColumns()), 1)
containerWindow:setContentHeight(filledLines*cellSize.height)
end
containerWindow:setup()
end
function onContainerClose(container)

@ -56,6 +56,8 @@ function init()
onSoulChange(localPlayer, localPlayer:getSoul())
onFreeCapacityChange(localPlayer, localPlayer:getFreeCapacity())
end
healthInfoWindow:setup()
end
function terminate()

@ -486,7 +486,6 @@ function onLeftPanelVisibilityChange(leftPanel, visible)
local children = leftPanel:getChildren()
for i=1,#children do
children[i]:setParent(gameRightPanel)
children[i]:saveParent(gameRightPanel)
end
end
end

@ -29,6 +29,7 @@ function init()
inventoryPanel = inventoryWindow:getChildById('contentsPanel')
refresh()
inventoryWindow:setup()
end
function terminate()

@ -40,6 +40,7 @@ function init()
minimapWidget.onMouseWheel = onMinimapMouseWheel
reset()
minimapWindow:setup()
end
function terminate()

@ -31,6 +31,7 @@ function init()
g_keyboard.bindKeyDown('Ctrl+S', toggle)
refresh()
skillsWindow:setup()
end
function terminate()

@ -15,6 +15,7 @@ function init()
vipWindow = g_ui.loadUI('viplist.otui', modules.game_interface.getRightPanel())
refresh()
vipWindow:setup()
end
function terminate()

불러오는 중...
취소
저장