on master help sign in
Fix use of JS reserved word and get `outline` working.
commit82a5a65dc95e11e6011a60fcfa9c307468c75023 authorevancz <info@elm-lang.org> dateThu 21 Mar 2013, 03:07 (14 years ago) parentfa9d3bf
2 files changed+14−6
libraries/Graphics/LineStyle.elm+4−4 runtime/Render/Collage.js+10−2
libraries/Graphics/LineStyle.elm+4−4
@@ -16,7 +16,7 @@ type LineStyle = {
1616 dashOffset : Int
1717 }
1818
19−default = {
19+basic = {
2020 color = Color.black,
2121 width = 1,
2222 cap = Butt,
@@ -26,6 +26,6 @@ default = {
2626 miterLimit = 10
2727 }
2828
29−solid clr = { default | color <- clr }
30−dashed clr = { default | color <- clr, dashing <- [8,4] }
31−dotted clr = { default | color <- clr, dashing <- [3,3] }
29+solid clr = { basic | color <- clr }
30+dashed clr = { basic | color <- clr, dashing <- [8,4] }
31+dotted clr = { basic | color <- clr, dashing <- [3,3] }
runtime/Render/Collage.js+10−2
@@ -15,6 +15,10 @@ function trace(ctx, path) {
1515 if (i <= 0) return;
1616 ctx.moveTo(points[i]._0, points[i]._1);
1717 while (i--) { ctx.lineTo(points[i]._0, points[i]._1); }
18+ if (path.closed) {
19+ i = points.length - 1;
20+ ctx.lineTo(points[i]._0, points[i]._1);
21+ }
1822}
1923
2024function line(ctx,style,path) {
@@ -118,8 +122,12 @@ function renderForm(redo,ctx,form) {
118122 switch(f.ctor) {
119123 case 'FPath' : drawLine(ctx, f._0, f._1); break;
120124 case 'FShape':
121− if (form.form._0.ctor === 'Left') drawLine(ctx, f._0._0, f._1);
122− else drawShape(redo, ctx, f._0._0, f._1);
125+ if (f._0.ctor === 'Left') {
126+ f._1.closed = true;
127+ drawLine(ctx, f._0._0, f._1);
128+ } else {
129+ drawShape(redo, ctx, f._0._0, f._1);
130+ }
123131 break;
124132 case 'FImage': drawImage(redo, ctx, f); break;
125133 case 'FGroup': renderForms(redo, ctx, f._0); break;