git @ Cat's Eye Technologies Pixley / b6846b0
Allow both horizontal and vertical depiction. Cat's Eye Technologies 11 years ago
1 changed file(s) with 29 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
157157 var w = 0;
158158 var h = 0;
159159
160 origSexp.horizontal = false;
160161 for (var i = 0; i < len; i++) {
161 if (children[i] === null) {
162 continue;
163 }
164 w += children[i].width;
165 if (children[i].height + margin * 2 > h) {
166 h = children[i].height + margin * 2;
167 }
168 }
169
170 origSexp.width = w + margin * (len + 1);
162 // alert(i + '...' + w);
163 if (origSexp.horizontal) {
164 w += children[i].width || 0;
165 if (children[i].height + margin * 2 > h) {
166 h = children[i].height + margin * 2;
167 }
168 } else {
169 h += children[i].height || 0;
170 if (children[i].width + margin * 2 > w) {
171 w = children[i].width + margin * 2;
172 }
173 }
174 }
175
176 if (origSexp.horizontal) {
177 w = w + margin * (len + 1);
178 } else {
179 h = h + margin * (len + 1);
180 }
181 origSexp.width = w;
171182 origSexp.height = h;
172183 } else {
173184 /*
219230 ctx.strokeStyle = "black";
220231 ctx.lineWidth = 1;
221232 ctx.strokeRect(x - 0.5, y - 0.5, origSexp.width, origSexp.height);
222
233
223234 var innerX = x + margin;
235 var innerY = y + margin;
224236 for (var i = 0; i < len; i++) {
225237 if (children[i] === null) {
226238 continue;
227239 }
228 this.depictSexp(innerX, y + margin, children[i], colour);
229 innerX += children[i].width + margin;
240 this.depictSexp(innerX, innerY, children[i], colour);
241 if (origSexp.horizontal) {
242 innerX += children[i].width + margin;
243 } else {
244 innerY += children[i].height + margin;
245 }
230246 }
231247 } else {
232248 /*