mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 12:04:55 +02:00
Some fixes in hotkeys and other improvements
* Save last logged character and world instead of character name * Make focused label always visible in character list and hotkeys * Other fixes in hotkeys
This commit is contained in:
@@ -116,26 +116,26 @@ function UIScrollArea:onMouseWheel(mousePos, mouseWheel)
|
||||
return true
|
||||
end
|
||||
|
||||
function UIScrollArea:onChildFocusChange(focusedChild, oldFocused, reason)
|
||||
if focusedChild and (reason == MouseFocusReason or reason == KeyboardFocusReason) then
|
||||
function UIScrollArea:ensureChildVisible(child)
|
||||
if child then
|
||||
local paddingRect = self:getPaddingRect()
|
||||
if self.verticalScrollBar then
|
||||
local deltaY = paddingRect.y - focusedChild:getY()
|
||||
local deltaY = paddingRect.y - child:getY()
|
||||
if deltaY > 0 then
|
||||
self.verticalScrollBar:decrement(deltaY)
|
||||
end
|
||||
|
||||
deltaY = (focusedChild:getY() + focusedChild:getHeight()) - (paddingRect.y + paddingRect.height)
|
||||
deltaY = (child:getY() + child:getHeight()) - (paddingRect.y + paddingRect.height)
|
||||
if deltaY > 0 then
|
||||
self.verticalScrollBar:increment(deltaY)
|
||||
end
|
||||
else
|
||||
local deltaX = paddingRect.x - focusedChild:getX()
|
||||
local deltaX = paddingRect.x - child:getX()
|
||||
if deltaX > 0 then
|
||||
self.horizontalScrollBar:decrement(deltaX)
|
||||
end
|
||||
|
||||
deltaX = (focusedChild:getX() + focusedChild:getWidth()) - (paddingRect.x + paddingRect.width)
|
||||
deltaX = (child:getX() + child:getWidth()) - (paddingRect.x + paddingRect.width)
|
||||
if deltaX > 0 then
|
||||
self.horizontalScrollBar:increment(deltaX)
|
||||
end
|
||||
@@ -143,6 +143,12 @@ function UIScrollArea:onChildFocusChange(focusedChild, oldFocused, reason)
|
||||
end
|
||||
end
|
||||
|
||||
function UIScrollArea:onChildFocusChange(focusedChild, oldFocused, reason)
|
||||
if focusedChild and (reason == MouseFocusReason or reason == KeyboardFocusReason) then
|
||||
self:ensureChildVisible(focusedChild)
|
||||
end
|
||||
end
|
||||
|
||||
function UIScrollArea:onScrollWidthChange()
|
||||
if self.alwaysScrollMaximum and self.horizontalScrollBar then
|
||||
self.horizontalScrollBar:setValue(self.horizontalScrollBar:getMaximum())
|
||||
|
Reference in New Issue
Block a user