mirror of
https://github.com/TangentFoxy/Pop.Box.git
synced 2024-12-15 12:44:20 +00:00
small changes
This commit is contained in:
parent
978562774a
commit
7121cc1773
@ -72,6 +72,10 @@
|
|||||||
<td class="name" nowrap><a href="#element.debugDraw-todo7">element.debugDraw-todo7</a></td>
|
<td class="name" nowrap><a href="#element.debugDraw-todo7">element.debugDraw-todo7</a></td>
|
||||||
<td class="summary">doc me</td>
|
<td class="summary">doc me</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="name" nowrap><a href="#element.debugDraw-todo7-todo8">element.debugDraw-todo7-todo8</a></td>
|
||||||
|
<td class="summary">document this</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<h2><a href="#Methods">Methods</a></h2>
|
<h2><a href="#Methods">Methods</a></h2>
|
||||||
<table class="function_list">
|
<table class="function_list">
|
||||||
@ -111,6 +115,10 @@
|
|||||||
<td class="name" nowrap><a href="#element.move">element.move (self, x, y)</a></td>
|
<td class="name" nowrap><a href="#element.move">element.move (self, x, y)</a></td>
|
||||||
<td class="summary">Moves an element by specified x/y.</td>
|
<td class="summary">Moves an element by specified x/y.</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="name" nowrap><a href="#element.delete">element.delete (self)</a></td>
|
||||||
|
<td class="summary">Deletes references to this element and then deletes it.</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
@ -133,6 +141,20 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
<a name = "element.debugDraw-todo7-todo8"></a>
|
||||||
|
<strong>element.debugDraw-todo7-todo8</strong>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
document this
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<h2 class="section-header "><a name="Methods"></a>Methods</h2>
|
<h2 class="section-header "><a name="Methods"></a>Methods</h2>
|
||||||
@ -404,6 +426,28 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
<a name = "element.delete"></a>
|
||||||
|
<strong>element.delete (self)</strong>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
Deletes references to this element and then deletes it.
|
||||||
|
|
||||||
|
|
||||||
|
<h3>Parameters:</h3>
|
||||||
|
<ul>
|
||||||
|
<li><span class="parameter">self</span>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
@ -412,7 +456,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2017-04-08 17:10:29 </i>
|
<i style="float:right;">Last updated 2017-04-09 02:01:53 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
<h2><a href="#Issues">Issues</a></h2>
|
<h2><a href="#Issues">Issues</a></h2>
|
||||||
<table class="function_list">
|
<table class="function_list">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="name" nowrap><a href="#window.new-todo8">window.new-todo8</a></td>
|
<td class="name" nowrap><a href="#window.new-todo9">window.new-todo9</a></td>
|
||||||
<td class="summary">if data, do stuff about it</td>
|
<td class="summary">if data, do stuff about it</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@ -88,8 +88,8 @@
|
|||||||
|
|
||||||
<dl class="function">
|
<dl class="function">
|
||||||
<dt>
|
<dt>
|
||||||
<a name = "window.new-todo8"></a>
|
<a name = "window.new-todo9"></a>
|
||||||
<strong>window.new-todo8</strong>
|
<strong>window.new-todo9</strong>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
if data, do stuff about it
|
if data, do stuff about it
|
||||||
@ -144,7 +144,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2017-04-08 17:10:29 </i>
|
<i style="float:right;">Last updated 2017-04-09 02:01:53 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2017-04-08 17:10:29 </i>
|
<i style="float:right;">Last updated 2017-04-09 02:01:53 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@ -491,7 +491,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2017-04-08 17:10:29 </i>
|
<i style="float:right;">Last updated 2017-04-09 02:01:53 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@ -105,7 +105,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2017-04-08 17:10:29 </i>
|
<i style="float:right;">Last updated 2017-04-09 02:01:53 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@ -723,7 +723,7 @@ table.insert element.parent, element.parent\removeChild(element),
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2017-04-08 17:10:29 </i>
|
<i style="float:right;">Last updated 2017-04-09 02:01:53 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@ -126,7 +126,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2017-04-08 17:10:29 </i>
|
<i style="float:right;">Last updated 2017-04-09 02:01:53 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@ -49,6 +49,34 @@ do
|
|||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end,
|
end,
|
||||||
|
setPosition = function(self, x, y, toPixel)
|
||||||
|
if toPixel == nil then
|
||||||
|
toPixel = true
|
||||||
|
end
|
||||||
|
if x then
|
||||||
|
self.data.x = x
|
||||||
|
end
|
||||||
|
if y then
|
||||||
|
self.data.y = y
|
||||||
|
end
|
||||||
|
local _exp_0 = self.data.horizontal
|
||||||
|
if "center" == _exp_0 then
|
||||||
|
self.data.x = self.data.x - (self.data.w / 2)
|
||||||
|
elseif "right" == _exp_0 then
|
||||||
|
self.data.x = self.data.x - self.data.w
|
||||||
|
end
|
||||||
|
local _exp_1 = self.data.vertical
|
||||||
|
if "center" == _exp_1 then
|
||||||
|
self.data.y = self.data.y - (self.data.h / 2)
|
||||||
|
elseif "bottom" == _exp_1 then
|
||||||
|
self.data.y = self.data.y - self.data.h
|
||||||
|
end
|
||||||
|
if toPixel then
|
||||||
|
self.data.x = floor(self.data.x)
|
||||||
|
self.data.y = floor(self.data.y)
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end,
|
||||||
setSize = function(self, w, h)
|
setSize = function(self, w, h)
|
||||||
if w then
|
if w then
|
||||||
self.data.w = w
|
self.data.w = w
|
||||||
@ -86,6 +114,20 @@ do
|
|||||||
self.data.x = self.data.x + x
|
self.data.x = self.data.x + x
|
||||||
self.data.y = self.data.y + y
|
self.data.y = self.data.y + y
|
||||||
return self
|
return self
|
||||||
|
end,
|
||||||
|
delete = function(self)
|
||||||
|
for i = 1, #self.parent.child do
|
||||||
|
if self.parent.child[i] == self then
|
||||||
|
table.remove(self.parent.child, i)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for i = 1, #self.parent.data.child do
|
||||||
|
if self.parent.data.child[i] == self.data then
|
||||||
|
table.remove(self.parent.data.child, i)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
_base_0.__index = _base_0
|
_base_0.__index = _base_0
|
||||||
@ -117,7 +159,7 @@ do
|
|||||||
self.data.h = 0
|
self.data.h = 0
|
||||||
end
|
end
|
||||||
if self.data.update == nil then
|
if self.data.update == nil then
|
||||||
self.data.update = false
|
self.data.update = true
|
||||||
end
|
end
|
||||||
if self.data.draw == nil then
|
if self.data.draw == nil then
|
||||||
self.data.draw = true
|
self.data.draw = true
|
||||||
|
@ -21,7 +21,7 @@ class element
|
|||||||
@data.y = 0 unless @data.y
|
@data.y = 0 unless @data.y
|
||||||
@data.w = 0 unless @data.w
|
@data.w = 0 unless @data.w
|
||||||
@data.h = 0 unless @data.h
|
@data.h = 0 unless @data.h
|
||||||
@data.update = false if @data.update == nil
|
@data.update = true if @data.update == nil
|
||||||
@data.draw = true if @data.draw == nil
|
@data.draw = true if @data.draw == nil
|
||||||
@data.type = "element" unless @data.type
|
@data.type = "element" unless @data.type
|
||||||
@data.align = true if (@data.align == nil) and @parent
|
@data.align = true if (@data.align == nil) and @parent
|
||||||
@ -73,6 +73,31 @@ class element
|
|||||||
|
|
||||||
return @
|
return @
|
||||||
|
|
||||||
|
--- @todo document this
|
||||||
|
setPosition: (x, y, toPixel=true) =>
|
||||||
|
if x
|
||||||
|
@data.x = x
|
||||||
|
if y
|
||||||
|
@data.y = y
|
||||||
|
|
||||||
|
switch @data.horizontal
|
||||||
|
when "center"
|
||||||
|
@data.x -= @data.w / 2
|
||||||
|
when "right"
|
||||||
|
@data.x -= @data.w
|
||||||
|
|
||||||
|
switch @data.vertical
|
||||||
|
when "center"
|
||||||
|
@data.y -= @data.h / 2
|
||||||
|
when "bottom"
|
||||||
|
@data.y -= @data.h
|
||||||
|
|
||||||
|
if toPixel
|
||||||
|
@data.x = floor @data.x
|
||||||
|
@data.y = floor @data.y
|
||||||
|
|
||||||
|
return @
|
||||||
|
|
||||||
--- Sets an element's width/height. Fixes alignment if needed.
|
--- Sets an element's width/height. Fixes alignment if needed.
|
||||||
--- @tparam integer w[opt] Width.
|
--- @tparam integer w[opt] Width.
|
||||||
--- @tparam integer h[opt] Height.
|
--- @tparam integer h[opt] Height.
|
||||||
@ -123,3 +148,23 @@ class element
|
|||||||
@data.x += x
|
@data.x += x
|
||||||
@data.y += y
|
@data.y += y
|
||||||
return @
|
return @
|
||||||
|
|
||||||
|
--- Deletes references to this element and then deletes it.
|
||||||
|
delete: =>
|
||||||
|
--for i=1, #@child
|
||||||
|
-- @child[i]\delete!
|
||||||
|
--@data.child -- for each child, delete its parent ref!
|
||||||
|
|
||||||
|
for i=1, #@parent.child
|
||||||
|
if @parent.child[i] == @
|
||||||
|
table.remove @parent.child, i
|
||||||
|
break
|
||||||
|
|
||||||
|
for i=1, #@parent.data.child
|
||||||
|
if @parent.data.child[i] == @data
|
||||||
|
table.remove @parent.data.child, i
|
||||||
|
break
|
||||||
|
|
||||||
|
--@parent = nil
|
||||||
|
--@data.parent = nil -- really should be for all @data -> nil, and for all @ -> nil
|
||||||
|
--@ = nil
|
||||||
|
@ -434,7 +434,7 @@ pop.import = (data, parent=pop.screen) ->
|
|||||||
data = loads(data)
|
data = loads(data)
|
||||||
element = pop.create(data.type, parent, data)
|
element = pop.create(data.type, parent, data)
|
||||||
else
|
else
|
||||||
element = pop.elements[data.type](parent, data)
|
element = pop.elements[data.type](parent, data) --why is it not the same as the other way?
|
||||||
insert parent.child, element
|
insert parent.child, element
|
||||||
|
|
||||||
for i = 1, #data.child
|
for i = 1, #data.child
|
||||||
|
Loading…
Reference in New Issue
Block a user