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:setHeight(500)
|
||||||
w2:move(0, -175)
|
w2:move(0, -175)
|
||||||
w2.title:align("center")
|
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:align("center")
|
||||||
--w2:setAlignment("center"):align("center")
|
--w2:setAlignment("center"):align("center")
|
||||||
|
|
||||||
|
@ -189,6 +189,9 @@ do
|
|||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end,
|
end,
|
||||||
|
getAlignment = function(self)
|
||||||
|
return self.horizontal, self.vertical
|
||||||
|
end,
|
||||||
setMargin = function(self, margin)
|
setMargin = function(self, margin)
|
||||||
self.margin = margin
|
self.margin = margin
|
||||||
self:align()
|
self:align()
|
||||||
|
@ -58,6 +58,7 @@ do
|
|||||||
self.window:setWidth(w)
|
self.window:setWidth(w)
|
||||||
self.w = w
|
self.w = w
|
||||||
self.x = self.x + x
|
self.x = self.x + x
|
||||||
|
self.title:align()
|
||||||
end
|
end
|
||||||
if h then
|
if h then
|
||||||
h = h - self.head:getHeight()
|
h = h - self.head:getHeight()
|
||||||
@ -72,7 +73,6 @@ do
|
|||||||
self.y = self.y + y
|
self.y = self.y + y
|
||||||
end
|
end
|
||||||
self.head:move(x, y)
|
self.head:move(x, y)
|
||||||
self.title:move(x, y)
|
|
||||||
self.window:move(x, y)
|
self.window:move(x, y)
|
||||||
return self
|
return self
|
||||||
end,
|
end,
|
||||||
@ -88,8 +88,8 @@ do
|
|||||||
self.window:setWidth(w)
|
self.window:setWidth(w)
|
||||||
self.w = w
|
self.w = w
|
||||||
self.x = self.x + x
|
self.x = self.x + x
|
||||||
|
self.title:align()
|
||||||
self.head:move(x)
|
self.head:move(x)
|
||||||
self.title:move(x)
|
|
||||||
self.window:move(x)
|
self.window:move(x)
|
||||||
return self
|
return self
|
||||||
end,
|
end,
|
||||||
@ -105,9 +105,9 @@ do
|
|||||||
self.window:setHeight(h)
|
self.window:setHeight(h)
|
||||||
self.h = h + self.head:getHeight()
|
self.h = h + self.head:getHeight()
|
||||||
self.y = self.y + y
|
self.y = self.y + y
|
||||||
self.head:move(x, y)
|
self.head:move(nil, y)
|
||||||
self.title:move(x, y)
|
self.title:move(nil, y)
|
||||||
self.window:move(x, y)
|
self.window:move(nil, y)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,13 @@ element.__base.height = function(self, h)
|
|||||||
return self:getHeight()
|
return self:getHeight()
|
||||||
end
|
end
|
||||||
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)
|
element.__base.margin = function(self, m)
|
||||||
if m then
|
if m then
|
||||||
return self:setMargin(m)
|
return self:setMargin(m)
|
||||||
|
@ -189,6 +189,9 @@ do
|
|||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end,
|
end,
|
||||||
|
getAlignment = function(self)
|
||||||
|
return self.horizontal, self.vertical
|
||||||
|
end,
|
||||||
setMargin = function(self, margin)
|
setMargin = function(self, margin)
|
||||||
self.margin = margin
|
self.margin = margin
|
||||||
self:align()
|
self:align()
|
||||||
|
@ -58,6 +58,7 @@ do
|
|||||||
self.window:setWidth(w)
|
self.window:setWidth(w)
|
||||||
self.w = w
|
self.w = w
|
||||||
self.x = self.x + x
|
self.x = self.x + x
|
||||||
|
self.title:align()
|
||||||
end
|
end
|
||||||
if h then
|
if h then
|
||||||
h = h - self.head:getHeight()
|
h = h - self.head:getHeight()
|
||||||
@ -72,7 +73,6 @@ do
|
|||||||
self.y = self.y + y
|
self.y = self.y + y
|
||||||
end
|
end
|
||||||
self.head:move(x, y)
|
self.head:move(x, y)
|
||||||
self.title:move(x, y)
|
|
||||||
self.window:move(x, y)
|
self.window:move(x, y)
|
||||||
return self
|
return self
|
||||||
end,
|
end,
|
||||||
@ -88,8 +88,8 @@ do
|
|||||||
self.window:setWidth(w)
|
self.window:setWidth(w)
|
||||||
self.w = w
|
self.w = w
|
||||||
self.x = self.x + x
|
self.x = self.x + x
|
||||||
|
self.title:align()
|
||||||
self.head:move(x)
|
self.head:move(x)
|
||||||
self.title:move(x)
|
|
||||||
self.window:move(x)
|
self.window:move(x)
|
||||||
return self
|
return self
|
||||||
end,
|
end,
|
||||||
@ -105,9 +105,9 @@ do
|
|||||||
self.window:setHeight(h)
|
self.window:setHeight(h)
|
||||||
self.h = h + self.head:getHeight()
|
self.h = h + self.head:getHeight()
|
||||||
self.y = self.y + y
|
self.y = self.y + y
|
||||||
self.head:move(x, y)
|
self.head:move(nil, y)
|
||||||
self.title:move(x, y)
|
self.title:move(nil, y)
|
||||||
self.window:move(x, y)
|
self.window:move(nil, y)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,13 @@ element.__base.height = function(self, h)
|
|||||||
return self:getHeight()
|
return self:getHeight()
|
||||||
end
|
end
|
||||||
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)
|
element.__base.margin = function(self, m)
|
||||||
if m then
|
if m then
|
||||||
return self:setMargin(m)
|
return self:setMargin(m)
|
||||||
|
@ -216,6 +216,9 @@ class element
|
|||||||
|
|
||||||
return @
|
return @
|
||||||
|
|
||||||
|
getAlignment: =>
|
||||||
|
return @horizontal, @vertical
|
||||||
|
|
||||||
setMargin: (margin) =>
|
setMargin: (margin) =>
|
||||||
@margin = margin
|
@margin = margin
|
||||||
@align!
|
@align!
|
||||||
|
@ -136,6 +136,8 @@ class window extends element
|
|||||||
@w = w
|
@w = w
|
||||||
@x += x
|
@x += x
|
||||||
|
|
||||||
|
@title\align!
|
||||||
|
|
||||||
if h
|
if h
|
||||||
h = h - @head\getHeight!
|
h = h - @head\getHeight!
|
||||||
switch @vertical
|
switch @vertical
|
||||||
@ -149,7 +151,7 @@ class window extends element
|
|||||||
@y += y
|
@y += y
|
||||||
|
|
||||||
@head\move x, y
|
@head\move x, y
|
||||||
@title\move x, y
|
--@title\move x, y
|
||||||
@window\move x, y
|
@window\move x, y
|
||||||
|
|
||||||
return @
|
return @
|
||||||
@ -168,8 +170,10 @@ class window extends element
|
|||||||
@w = w
|
@w = w
|
||||||
@x += x
|
@x += x
|
||||||
|
|
||||||
|
@title\align!
|
||||||
|
|
||||||
@head\move x
|
@head\move x
|
||||||
@title\move x
|
--@title\move x
|
||||||
@window\move x
|
@window\move x
|
||||||
|
|
||||||
return @
|
return @
|
||||||
@ -188,8 +192,8 @@ class window extends element
|
|||||||
@h = h + @head\getHeight!
|
@h = h + @head\getHeight!
|
||||||
@y += y
|
@y += y
|
||||||
|
|
||||||
@head\move x, y
|
@head\move nil, y
|
||||||
@title\move x, y
|
@title\move nil, y
|
||||||
@window\move x, y
|
@window\move nil, y
|
||||||
|
|
||||||
return @
|
return @
|
||||||
|
@ -31,6 +31,13 @@ element.__base.height = (h) =>
|
|||||||
else
|
else
|
||||||
return @getHeight!
|
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) =>
|
element.__base.margin = (m) =>
|
||||||
if m
|
if m
|
||||||
return @setMargin m
|
return @setMargin m
|
||||||
|
Loading…
Reference in New Issue
Block a user