on master help sign in
Fix another rendering bug for collages.
commit3829a951d3e2096fa69749cb328b1ffe66d458a9 authorevancz <info@elm-lang.org> dateSat 1 Jun 2013, 11:09 (13 years ago) parent35d6019
1 file changed+8−13
runtime/Render/Collage.js+8−13
runtime/Render/Collage.js+8−13
@@ -205,7 +205,7 @@ function stepper(forms) {
205205 }
206206 // assumes that there is a next element
207207 function next(ctx) {
208− while (!ps[0].peekNext()) { ps.shift(); matrices.pop(); ctx.restore(); }
208+ while (!ps[0].peekNext()) { ps.shift(); matrices.pop(); if (ctx) { ctx.restore(); } }
209209 var out = ps[0].next();
210210 var f = out.form;
211211 if (f.ctor === 'FGroup') {
@@ -254,12 +254,13 @@ function updateTracker(w,h,div) {
254254 }
255255 function getContext(transforms) {
256256 while (i < kids.length) {
257− var node = kids[i++];
257+ var node = kids[i];
258258 if (node.getContext) {
259259 node.width = w;
260260 node.height = h;
261261 node.style.width = w + 'px';
262262 node.style.height = h + 'px';
263+ ++i;
263264 return transform(transforms, node.getContext('2d'));
264265 }
265266 div.removeChild(node);
@@ -277,16 +278,10 @@ function updateTracker(w,h,div) {
277278 container.style.overflow = 'hidden';
278279 container.style.position = 'absolute';
279280 addTransform(container.style, 'scaleY(-1)');
280− if (!container) {
281− div.appendChild(container);
282− } else {
283− var kid = kids[i];
284− if (kid) {
285− div.insertBefore(container, kid);
286− } else {
287− div.appendChild(container);
288− }
289− }
281+
282+ var kid = kids[i];
283+ kid ? div.insertBefore(container, kid)
284+ : div.appendChild(container);
290285 }
291286 // we have added a new node, so we must step our position
292287 ++i;
@@ -307,7 +302,7 @@ function updateTracker(w,h,div) {
307302 addTransform(node.style, makeTransform(w, h, form, matrices));
308303 }
309304 function clearRest() {
310− while (kids.length > i) {
305+ while (i < kids.length) {
311306 div.removeChild(kids[i]);
312307 }
313308 }