From 6af311bc1701172ca2c8aca48081429b49d368d8 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Mon, 31 Dec 2012 20:00:43 -0500 Subject: [PATCH] add ignore attribute to CenterContainer widget --- frontend/ui/widget.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/ui/widget.lua b/frontend/ui/widget.lua index df50504d0..d740600d5 100644 --- a/frontend/ui/widget.lua +++ b/frontend/ui/widget.lua @@ -126,9 +126,15 @@ function CenterContainer:paintTo(bb, x, y) -- throw error? paint to scrap buffer and blit partially? -- for now, we ignore this end - self[1]:paintTo(bb, - x + (self.dimen.w - contentSize.w)/2, - y + (self.dimen.h - contentSize.h)/2) + local x_pos = x + local y_pos = y + if self.ignore ~= "height" then + y_pos = y + (self.dimen.h - contentSize.h)/2 + end + if self.ignore ~= "width" then + x_pos = x + (self.dimen.w - contentSize.w)/2 + end + self[1]:paintTo(bb, x_pos, y_pos) end --[[