Skip to content

Commit

Permalink
pulling points out of template definition
Browse files Browse the repository at this point in the history
  • Loading branch information
SignpostMarv committed Mar 15, 2018
1 parent 7a77b2a commit 204c123
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/Shapes.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,11 @@ export class Polygon extends Line {
const { fillStyle, strokeStyle, lineWidth } = style;
const [width, height] = bounds.size.toArray();
const pointerEvents = clickable ? '' : 'pointer-events:none;';
const points = Coordinates.map((e) => {
const [x, y] = e.toArray();

return [x - posX, y - posY].join(',');
}).join(' ');
return html`<svg
width="${width}"
height="${height}"
Expand Down Expand Up @@ -371,13 +376,7 @@ export class Polygon extends Line {
);
"
>${svg`
<polygon points="${
Coordinates.map((e) => {
const [x, y] = e.toArray();
return [x - posX, y - posY].join(',');
}).join(' ')
}" />
<polygon points="${points}" />
`}</svg>`;
});
widget.position = this.bounds.bottomLeft;
Expand Down

0 comments on commit 204c123

Please sign in to comment.