From a541640cfe2a3cb7114de5205ddfb808a6913237 Mon Sep 17 00:00:00 2001 From: Paul Liverman III Date: Sun, 17 Apr 2016 00:40:48 -0700 Subject: [PATCH] deleting elements! --- demo/pop/elements/element.lua | 6 ++++++ lib/pop/elements/element.lua | 6 ++++++ src/pop/elements/element.moon | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/demo/pop/elements/element.lua b/demo/pop/elements/element.lua index f2651b4..1bbba88 100644 --- a/demo/pop/elements/element.lua +++ b/demo/pop/elements/element.lua @@ -235,6 +235,12 @@ do self.y = self.parent.y + self.margin self.w = self.parent.w - self.margin * 2 self.h = self.parent.h - self.margin * 2 + end, + delete = function(self) + for k, v in ipairs(self.child) do + v:delete() + end + return self.parent:removeChild(self) end } _base_0.__index = _base_0 diff --git a/lib/pop/elements/element.lua b/lib/pop/elements/element.lua index f2651b4..1bbba88 100644 --- a/lib/pop/elements/element.lua +++ b/lib/pop/elements/element.lua @@ -235,6 +235,12 @@ do self.y = self.parent.y + self.margin self.w = self.parent.w - self.margin * 2 self.h = self.parent.h - self.margin * 2 + end, + delete = function(self) + for k, v in ipairs(self.child) do + v:delete() + end + return self.parent:removeChild(self) end } _base_0.__index = _base_0 diff --git a/src/pop/elements/element.moon b/src/pop/elements/element.moon index 9f6db91..80dfcec 100644 --- a/src/pop/elements/element.moon +++ b/src/pop/elements/element.moon @@ -253,3 +253,9 @@ class element @y = @parent.y + @margin @w = @parent.w - @margin*2 @h = @parent.h - @margin*2 + + delete: => + for k,v in ipairs @child + v\delete! + + @parent\removeChild @