mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 03:54:54 +02:00
Minor fixes and improvements
This commit is contained in:
@@ -17,6 +17,7 @@ Module
|
||||
dofile 'settings'
|
||||
dofile 'keyboard'
|
||||
dofile 'mouse'
|
||||
dofile 'net'
|
||||
|
||||
dofiles 'ui'
|
||||
|
||||
|
16
modules/corelib/net.lua
Normal file
16
modules/corelib/net.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
function translateNetworkError(errcode, connecting, errdesc)
|
||||
local text
|
||||
if errcode == 111 then
|
||||
text = tr('Connection refused, the server might be offline or restarting.\nPlease try again later.')
|
||||
elseif errcode == 110 then
|
||||
text = tr('Connection timed out. Either your network is failing or the server is offline.')
|
||||
elseif errcode == 1 then
|
||||
text = tr('Connection failed, the server address does not exist.')
|
||||
elseif connecting then
|
||||
text = tr('Connection failed.')
|
||||
else
|
||||
text = tr('Your connection has been lost.\nEither your network or the server went down.')
|
||||
end
|
||||
text = text .. ' ' .. tr('(ERROR %d)', errcode)
|
||||
return text
|
||||
end
|
@@ -83,10 +83,17 @@ local function onTabDragMove(tab, mousePos, mouseMoved)
|
||||
end
|
||||
end
|
||||
|
||||
local function tabBlink(tab)
|
||||
if not tab.blinking then return end
|
||||
local function tabBlink(tab, step)
|
||||
step = step or 0
|
||||
tab:setOn(not tab:isOn())
|
||||
tab.blinkEvent = scheduleEvent(function() tabBlink(tab) end, 500)
|
||||
|
||||
removeEvent(tab.blinkEvent)
|
||||
if step < 4 then
|
||||
tab.blinkEvent = scheduleEvent(function() tabBlink(tab, step+1) end, 500)
|
||||
else
|
||||
tab:setOn(true)
|
||||
tab.blinkEvent = nil
|
||||
end
|
||||
end
|
||||
|
||||
-- public functions
|
||||
@@ -240,7 +247,7 @@ function UIMoveableTabBar:selectPrevTab()
|
||||
end
|
||||
|
||||
function UIMoveableTabBar:blinkTab(tab)
|
||||
if tab:isChecked() or tab.blinking then return end
|
||||
if tab:isChecked() then return end
|
||||
tab.blinking = true
|
||||
tabBlink(tab)
|
||||
end
|
||||
|
@@ -237,7 +237,7 @@ function UIScrollBar:onMouseWheel(mousePos, mouseWheel)
|
||||
if not self.mouseScroll then
|
||||
return false
|
||||
end
|
||||
if mouseWheel == MouseWheelDown then
|
||||
if mouseWheel == MouseWheelUp then
|
||||
if self.orientation == 'vertical' then
|
||||
self:decrement()
|
||||
else
|
||||
|
@@ -19,14 +19,15 @@ function UITextEdit:onMouseWheel(mousePos, mouseWheel)
|
||||
else
|
||||
self.verticalScrollBar:increment()
|
||||
end
|
||||
return true
|
||||
elseif self.horizontalScrollBar then
|
||||
if mouseWheel == MouseWheelUp then
|
||||
self.horizontalScrollBar:increment()
|
||||
else
|
||||
self.horizontalScrollBar:decrement()
|
||||
end
|
||||
return true
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function UITextEdit:onTextAreaUpdate(virtualOffset, virtualSize, totalSize)
|
||||
|
Reference in New Issue
Block a user