4 * This file is part of CameraPlus.
6 * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 var stack = new Array();
25 function push(items) {
26 if (stack.length >= 1) {
27 hide(stack[stack.length - 1]);
36 var items = stack[stack.length - 1];
42 function hide(items) {
43 var len = items.length;
45 for (var x = 0; x < len; x++) {
51 function show(items) {
52 var len = items.length;
55 for (var x = 0; x < len; x++) {
56 width += items[x].width;
59 var totalWidth = tools.width - width;
63 totalWidth -= tools.menuWidth;
66 var spacing = totalWidth / len;
68 for (var x = 0; x < items.length; x++) {
72 var prev = items[x - 1];
73 child.x = prev.x + prev.width + spacing;
74 } else if (tools.hideBack) {
77 child.x = spacing + 80;
87 if (stack.length == 0) {
91 var items = stack[stack.length - 1];
92 var len = items.length;
94 if (!tools.expanded) {
97 else if (tools.width == tools.targetWidth) {