fix rect.resize
This commit is contained in:
@@ -52,7 +52,7 @@ function rect:height()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- resize rect
|
-- resize rect
|
||||||
function rect:on_resize(w, h)
|
function rect:resize(w, h)
|
||||||
self.ex = self.sx + w
|
self.ex = self.sx + w
|
||||||
self.ey = self.sy + h
|
self.ey = self.sy + h
|
||||||
end
|
end
|
||||||
|
@@ -59,7 +59,7 @@ function window:init(name, bounds, title, shadow)
|
|||||||
self:title():action_set(action.ac_on_text_changed, function (v)
|
self:title():action_set(action.ac_on_text_changed, function (v)
|
||||||
if v:text() then
|
if v:text() then
|
||||||
local bounds = v:bounds()
|
local bounds = v:bounds()
|
||||||
v:bounds():on_resize(#v:text(), v:height())
|
v:bounds():resize(#v:text(), v:height())
|
||||||
bounds:move2(math.max(0, math.floor((self:frame():width() - v:width()) / 2)), bounds.sy)
|
bounds:move2(math.max(0, math.floor((self:frame():width() - v:width()) / 2)), bounds.sy)
|
||||||
v:invalidate(true)
|
v:invalidate(true)
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user