mirror of
https://github.com/edubart/otclient.git
synced 2025-12-01 07:36:49 +01:00
some window moving
This commit is contained in:
@@ -3,6 +3,7 @@ UIWindow = extends(UIWidget)
|
||||
function UIWindow.create()
|
||||
local window = UIWindow.internalCreate()
|
||||
window:setTextAlign(AlignTopCenter)
|
||||
window:setDragable(true)
|
||||
return window
|
||||
end
|
||||
|
||||
@@ -20,6 +21,17 @@ function UIWindow:onMousePress(mousePos, mouseButton)
|
||||
|
||||
end
|
||||
|
||||
function UIWindow:onGeometryChange(oldRect, newRect)
|
||||
|
||||
function UIWindow:onDragEnter(mousePos)
|
||||
self:breakAnchors()
|
||||
self.movingReference = { x = mousePos.x - self:getX(), y = mousePos.y - self:getY() }
|
||||
end
|
||||
|
||||
function UIWindow:onDragLeave(droppedWidget, mousePos)
|
||||
-- TODO: auto detect and reconnect anchors
|
||||
end
|
||||
|
||||
function UIWindow:onDragMove(mousePos, mouseMoved)
|
||||
local pos = { x = mousePos.x - self.movingReference.x, y = mousePos.y - self.movingReference.y }
|
||||
self:setPosition(pos)
|
||||
self:bindRectToParent()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user