Minor fix to previous commit and added mouse scroll option to UIScrollBar class.

This commit is contained in:
BeniS 2013-01-11 20:10:37 +13:00
parent 914b4bd5f3
commit 1b6be92cad
3 changed files with 23 additions and 6 deletions

View File

@ -108,6 +108,7 @@ function UIScrollBar.create()
scrollbar.pixelsScroll = false
scrollbar.showValue = false
scrollbar.symbol = nil
scrollbar.mouseScroll = true
return scrollbar
end
@ -139,6 +140,8 @@ function UIScrollBar:onStyleApply(styleName, styleNode)
self.showValue = true
elseif name == 'symbol' then
self.symbol = value
elseif name == 'mouse-scroll' then
self.mouseScroll = value
end
end
end
@ -189,6 +192,10 @@ function UIScrollBar:setValue(value)
end
end
function UIScrollBar:setMouseScroll(scroll)
self.mouseScroll = scroll
end
function UIScrollBar:setStep(step)
self.step = step
end
@ -202,6 +209,9 @@ function UIScrollBar:onGeometryChange()
end
function UIScrollBar:onMouseWheel(mousePos, mouseWheel)
if not self.mouseScroll then
return false
end
if mouseWheel == MouseWheelDown then
if self.orientation == 'vertical' then
self:decrement()
@ -224,4 +234,5 @@ function UIScrollBar:getValue() return math.round(self.value) end
function UIScrollBar:getStep() return self.step end
function UIScrollBar:getOrientation() return self.orientation end
function UIScrollBar:getShowValue() return self.showValue end
function UIScrollBar:getSymbol() return self.symbol end
function UIScrollBar:getSymbol() return self.symbol end
function UIScrollBar:getMouseScroll() return self.mouseScroll end

View File

@ -359,10 +359,10 @@ function addTabText(text, speaktype, tab, creatureName)
-- Overlay for consoleBuffer which shows highlighted words only
local consoleBufferHighlight = panel:getChildById('consoleBufferHighlight')
local labelHighlight = g_ui.createWidget('ConsoleLabel', consoleBufferHighlight)
labelHighlight:setId('consoleLabel' .. panel:getChildCount())
labelHighlight:setColor("#1f9ffe")
local player = g_game.getLocalPlayer()
if speaktype.npcChat and (player:getName() ~= creatureName or player:getName() == 'Account Manager') then -- Check if it is the npc who is talking
local highlightData = getHighlightedText(text)
@ -411,7 +411,9 @@ function addTabText(text, speaktype, tab, creatureName)
labelHighlight:setText("")
end
label.onMouseRelease = function (self, mousePos, mouseButton) processMessageMenu(mousePos, mouseButton, creatureName, text) end
label.onMouseRelease = function (self, mousePos, mouseButton)
processMessageMenu(mousePos, mouseButton, creatureName, text)
end
if consoleBuffer:getChildCount() > MAX_LINES then
consoleBuffer:getFirstChild():destroy()
@ -476,8 +478,12 @@ function sendCurrentMessage()
if #message == 0 then return end
consoleTextEdit:clearText()
-- get current channel
local tab = getCurrentTab()
-- send message
sendMessage(message)
end
function sendMessage(message, tab)
local tab = tab or getCurrentTab()
-- handling chat commands
local originalMessage = message

View File

@ -85,7 +85,7 @@ end
function load()
local hotkeySettings = g_settings.getNode('HotkeysManager') or {}
if hotkeySettings then
if hotkeySettings ~= nil then
local playerHotkeySettings = hotkeySettings[g_game.getLocalPlayer():getName()]
local hasCombos = false