mirror of
https://github.com/TangentFoxy/Pop.Box.git
synced 2024-12-15 12:44:20 +00:00
fixed window title displacement
This commit is contained in:
parent
cdf3f99705
commit
bbca9b5a3e
@ -37,7 +37,9 @@ function love.load()
|
||||
w2:setHeight(500)
|
||||
w2:move(0, -175)
|
||||
w2.title:align("center")
|
||||
w2:size(200, 120)
|
||||
w2:position(0, 0)
|
||||
--w2:setAlignment("right")
|
||||
w2:size(200, 120):position(90, 70)
|
||||
--w2:align("center")
|
||||
--w2:setAlignment("center"):align("center")
|
||||
|
||||
|
@ -189,6 +189,9 @@ do
|
||||
end
|
||||
return self
|
||||
end,
|
||||
getAlignment = function(self)
|
||||
return self.horizontal, self.vertical
|
||||
end,
|
||||
setMargin = function(self, margin)
|
||||
self.margin = margin
|
||||
self:align()
|
||||
|
@ -58,6 +58,7 @@ do
|
||||
self.window:setWidth(w)
|
||||
self.w = w
|
||||
self.x = self.x + x
|
||||
self.title:align()
|
||||
end
|
||||
if h then
|
||||
h = h - self.head:getHeight()
|
||||
@ -72,7 +73,6 @@ do
|
||||
self.y = self.y + y
|
||||
end
|
||||
self.head:move(x, y)
|
||||
self.title:move(x, y)
|
||||
self.window:move(x, y)
|
||||
return self
|
||||
end,
|
||||
@ -88,8 +88,8 @@ do
|
||||
self.window:setWidth(w)
|
||||
self.w = w
|
||||
self.x = self.x + x
|
||||
self.title:align()
|
||||
self.head:move(x)
|
||||
self.title:move(x)
|
||||
self.window:move(x)
|
||||
return self
|
||||
end,
|
||||
@ -105,9 +105,9 @@ do
|
||||
self.window:setHeight(h)
|
||||
self.h = h + self.head:getHeight()
|
||||
self.y = self.y + y
|
||||
self.head:move(x, y)
|
||||
self.title:move(x, y)
|
||||
self.window:move(x, y)
|
||||
self.head:move(nil, y)
|
||||
self.title:move(nil, y)
|
||||
self.window:move(nil, y)
|
||||
return self
|
||||
end
|
||||
}
|
||||
|
@ -35,6 +35,13 @@ element.__base.height = function(self, h)
|
||||
return self:getHeight()
|
||||
end
|
||||
end
|
||||
element.__base.alignment = function(self, horizontal, vertical)
|
||||
if horizontal or vertical then
|
||||
return self:setAlignment(horizontal, vertical)
|
||||
else
|
||||
return self:getAlignment()
|
||||
end
|
||||
end
|
||||
element.__base.margin = function(self, m)
|
||||
if m then
|
||||
return self:setMargin(m)
|
||||
|
@ -189,6 +189,9 @@ do
|
||||
end
|
||||
return self
|
||||
end,
|
||||
getAlignment = function(self)
|
||||
return self.horizontal, self.vertical
|
||||
end,
|
||||
setMargin = function(self, margin)
|
||||
self.margin = margin
|
||||
self:align()
|
||||
|
@ -58,6 +58,7 @@ do
|
||||
self.window:setWidth(w)
|
||||
self.w = w
|
||||
self.x = self.x + x
|
||||
self.title:align()
|
||||
end
|
||||
if h then
|
||||
h = h - self.head:getHeight()
|
||||
@ -72,7 +73,6 @@ do
|
||||
self.y = self.y + y
|
||||
end
|
||||
self.head:move(x, y)
|
||||
self.title:move(x, y)
|
||||
self.window:move(x, y)
|
||||
return self
|
||||
end,
|
||||
@ -88,8 +88,8 @@ do
|
||||
self.window:setWidth(w)
|
||||
self.w = w
|
||||
self.x = self.x + x
|
||||
self.title:align()
|
||||
self.head:move(x)
|
||||
self.title:move(x)
|
||||
self.window:move(x)
|
||||
return self
|
||||
end,
|
||||
@ -105,9 +105,9 @@ do
|
||||
self.window:setHeight(h)
|
||||
self.h = h + self.head:getHeight()
|
||||
self.y = self.y + y
|
||||
self.head:move(x, y)
|
||||
self.title:move(x, y)
|
||||
self.window:move(x, y)
|
||||
self.head:move(nil, y)
|
||||
self.title:move(nil, y)
|
||||
self.window:move(nil, y)
|
||||
return self
|
||||
end
|
||||
}
|
||||
|
@ -35,6 +35,13 @@ element.__base.height = function(self, h)
|
||||
return self:getHeight()
|
||||
end
|
||||
end
|
||||
element.__base.alignment = function(self, horizontal, vertical)
|
||||
if horizontal or vertical then
|
||||
return self:setAlignment(horizontal, vertical)
|
||||
else
|
||||
return self:getAlignment()
|
||||
end
|
||||
end
|
||||
element.__base.margin = function(self, m)
|
||||
if m then
|
||||
return self:setMargin(m)
|
||||
|
@ -216,6 +216,9 @@ class element
|
||||
|
||||
return @
|
||||
|
||||
getAlignment: =>
|
||||
return @horizontal, @vertical
|
||||
|
||||
setMargin: (margin) =>
|
||||
@margin = margin
|
||||
@align!
|
||||
|
@ -136,6 +136,8 @@ class window extends element
|
||||
@w = w
|
||||
@x += x
|
||||
|
||||
@title\align!
|
||||
|
||||
if h
|
||||
h = h - @head\getHeight!
|
||||
switch @vertical
|
||||
@ -149,7 +151,7 @@ class window extends element
|
||||
@y += y
|
||||
|
||||
@head\move x, y
|
||||
@title\move x, y
|
||||
--@title\move x, y
|
||||
@window\move x, y
|
||||
|
||||
return @
|
||||
@ -168,8 +170,10 @@ class window extends element
|
||||
@w = w
|
||||
@x += x
|
||||
|
||||
@title\align!
|
||||
|
||||
@head\move x
|
||||
@title\move x
|
||||
--@title\move x
|
||||
@window\move x
|
||||
|
||||
return @
|
||||
@ -188,8 +192,8 @@ class window extends element
|
||||
@h = h + @head\getHeight!
|
||||
@y += y
|
||||
|
||||
@head\move x, y
|
||||
@title\move x, y
|
||||
@window\move x, y
|
||||
@head\move nil, y
|
||||
@title\move nil, y
|
||||
@window\move nil, y
|
||||
|
||||
return @
|
||||
|
@ -31,6 +31,13 @@ element.__base.height = (h) =>
|
||||
else
|
||||
return @getHeight!
|
||||
|
||||
element.__base.alignment = (horizontal, vertical) =>
|
||||
if horizontal or vertical
|
||||
return @setAlignment horizontal, vertical
|
||||
else
|
||||
return @getAlignment!
|
||||
|
||||
-- why is this bit here? Oo
|
||||
element.__base.margin = (m) =>
|
||||
if m
|
||||
return @setMargin m
|
||||
|
Loading…
Reference in New Issue
Block a user