diff --git a/docs/layout.rst b/docs/layout.rst index a9c986a..9b10f1b 100644 --- a/docs/layout.rst +++ b/docs/layout.rst @@ -29,19 +29,6 @@ Get and set the current cell padding. If given, sets the cell padding to ``pad_x`` and ``pad_y``. If only ``pad_x`` is given, set both padding in ``x`` and ``y`` direction to ``pad_x``. -.. function:: pos([x, y]) - - :param x,y: New layout position (optional). - :returns: The current (or new) layout position. - -Get and set the current layout position, that is, the upper left corner of the -*last* cell. - -If given, sets the layout position to ``x,y``. -Can be helpful when you want to reset the layout origin without resetting the -cell size information. -Use with care: Invalidates size information of the whole layout (see below). - .. function:: size() :returns: ``width,height`` - The size of the last cell. @@ -62,17 +49,14 @@ Use for mixing precomputed and immediate mode layouts. Get the position of the upper left corner of the next cell in a column layout. Use for mixing precomputed and immediate mode layouts. -.. function:: push([x,y, [padx, [pady]]]) +.. function:: push([x,y]) :param numbers x,y: Origin of the layout (optional). - :param pad_x,pad_y: Cell padding (optional). Saves the layout state (position, padding, sizes, etc.) on a stack, resets the -layout with position ``(x,y)`` and sets the cell padding to ``pad_x`` and -``pad_y``. +layout with position ``(x,y)``. -If ``x`` and ``y`` are omitted, they default to ``(0,0)``. If ``pad_x`` is -omitted, it defaults to 0. If ``pad_y`` is omitted, it defaults to ``pad_x``. +If ``x`` and ``y`` are omitted, they default to ``(0,0)``. Used for nested row/column layouts. diff --git a/layout.lua b/layout.lua index 19a0245..50097c5 100644 --- a/layout.lua +++ b/layout.lua @@ -26,13 +26,6 @@ function Layout:padding(padx,pady) return self._padx, self._pady end -function Layout:pos(x,y) - if x and y then - self._x, self._y = x, y - end - return self._x, self._y -end - function Layout:size() return self._w, self._h end @@ -164,7 +157,8 @@ local function layout_retained_mode(self, t, constructor, string_argument_to_tab error("Invalid argument `padding' (table expected, got "..type(p)..")", 2) end - self:push(p[1] or 0, p[2] or 0, pad[1] or self._padx, pad[2] or self._pady) + self:push(p[1] or 0, p[2] or 0) + self:padding(pad[1] or self._padx, pad[2] or self._pady) -- first pass: get dimensions, add layout info local layout = {n_fill_w = 0, n_fill_h = 0}