on master help sign in
Fix orientation of polygons and paths.
commit487494926cbeb1e1f1f883e3c1c2b631f8d22083 authorevancz <info@elm-lang.org> dateSat 1 Jun 2013, 11:57 (13 years ago) parent3829a95
1 file changed+4−1
runtime/Render/Collage.js+4−1
runtime/Render/Collage.js+4−1
@@ -23,6 +23,7 @@ function trace(ctx, path) {
2323
2424function line(ctx,style,path) {
2525 style.dashing.ctor === 'Nil' ? trace(ctx, path) : customLineHelp(ctx, style, path);
26+ ctx.scale(1,-1);
2627 ctx.stroke();
2728}
2829
@@ -107,6 +108,7 @@ function drawShape(redo, ctx, style, path) {
107108 ctx.fillStyle =
108109 sty === 'Solid' ? extract(style._0) :
109110 sty === 'Texture' ? texture(redo, ctx, style._0) : gradient(ctx, style._0);
111+ ctx.scale(1,-1);
110112 ctx.fill();
111113}
112114
@@ -126,6 +128,7 @@ function drawImage(redo, ctx, form) {
126128 destW = w,
127129 destH = h;
128130
131+ ctx.scale(1,-1);
129132 ctx.drawImage(img, srcX, srcY, srcW, srcH, destX, destY, destW, destH);
130133}
131134
@@ -134,7 +137,7 @@ function renderForm(redo, ctx, form) {
134137 var x = form.x, y = form.y, theta = form.theta, scale = form.scale;
135138 if (x !== 0 || y !== 0) ctx.translate(x, y);
136139 if (theta !== 0) ctx.rotate(theta);
137− ctx.scale(scale,-scale);
140+ if (scale !== 1) ctx.scale(scale,scale);
138141 ctx.beginPath();
139142 var f = form.form;
140143 switch(f.ctor) {