mirror of
https://github.com/edubart/otclient.git
synced 2025-04-30 09:39:21 +02:00

* i'm gradually restoring game functionality with the new modules design, though still a lot to do * you can reload all scripts and modules using Ctrl+R shortcut while playing (finally! this is the reason of all this rework) * a bunch of fixes, but new regression too :P * fix performance issue that could lead freezes in the client in older machines * completely new game module with new design * fix crashs in map render * remove uigame.cpp (now every game input is via lua) * enable DEBUG macro by default, with it you are able to view any possible lua leak while running
37 lines
976 B
Lua
37 lines
976 B
Lua
UIMiniWindow = extends(UIWindow)
|
|
|
|
function UIMiniWindow.create()
|
|
local miniwindow = UIMiniWindow.internalCreate()
|
|
return miniwindow
|
|
end
|
|
|
|
function UIMiniWindow:onDragEnter(mousePos)
|
|
local parent = self:getParent()
|
|
if not parent then return false end
|
|
|
|
if parent:getClassName() == 'UIMiniWindowContainer' then
|
|
local containerParent = parent:getParent()
|
|
parent:removeChild(self)
|
|
containerParent:addChild(self)
|
|
end
|
|
|
|
local oldPos = self:getPosition()
|
|
self.movingReference = { x = mousePos.x - oldPos.x, y = mousePos.y - oldPos.y }
|
|
self:setPosition(oldPos)
|
|
return true
|
|
end
|
|
|
|
function UIMiniWindow:onDragLeave(droppedWidget, mousePos)
|
|
-- TODO: drop on other interfaces
|
|
end
|
|
|
|
function UIMiniWindow:onFocusChange(focused)
|
|
-- miniwindows only raises when its outside MiniWindowContainers
|
|
if not focused then return end
|
|
local parent = self:getParent()
|
|
if parent and parent:getClassName() ~= 'UIMiniWindowContainer' then
|
|
self:raise()
|
|
end
|
|
end
|
|
|