diff options
| author | ruki <[email protected]> | 2017-12-27 22:28:06 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-12-27 08:48:41 +0800 |
| commit | c2af438912e29dec6f1e8962633f339a6ab2cab7 (patch) | |
| tree | ac5d5e8604cc4850de621716041a318253402d43 | |
| parent | 663308b956fb9cedbd002e980d716818f0b5e7b2 (diff) | |
fix group:draw()
| -rw-r--r-- | xmake/core/ui/group.lua | 5 | ||||
| -rw-r--r-- | xmake/core/ui/view.lua | 13 |
2 files changed, 17 insertions, 1 deletions
diff --git a/xmake/core/ui/group.lua b/xmake/core/ui/group.lua index 571064260..61ce7f8d7 100644 --- a/xmake/core/ui/group.lua +++ b/xmake/core/ui/group.lua @@ -40,6 +40,9 @@ function group:init(name, bounds) -- init view view.init(self, name, bounds) + -- mark as group + self:type_set("group") + -- mark as selectable self:option_set("selectable", true) @@ -259,7 +262,7 @@ function group:draw() if redraw then v:state_set("redraw", true) end - if v:state("visible") and v:state("redraw") then + if v:state("visible") and (v:state("redraw") or v:type() == "group") then v:draw() end end diff --git a/xmake/core/ui/view.lua b/xmake/core/ui/view.lua index 6af29906e..593fdccb4 100644 --- a/xmake/core/ui/view.lua +++ b/xmake/core/ui/view.lua @@ -51,6 +51,9 @@ function view:init(name, bounds) -- check assert(name and type(bounds) == 'table') + -- init type + self._TYPE = "view" + -- init state local state = object() state.visible = true -- view visibility @@ -247,6 +250,16 @@ function view:event_register(etype) self._EVENTS[etype] = true end +-- get type +function view:type() + return self._TYPE +end + +-- set type +function view:type_set(t) + self._TYPE = t or "view" +end + -- get state function view:state(name) return self._STATE[name] |
