jonobr1 / two.js

A renderer agnostic two-dimensional drawing api for the web.
https://two.js.org
MIT License
8.29k stars 454 forks source link

Fix Two.Polygon #631

Closed mmz-001 closed 2 years ago

mmz-001 commented 2 years ago

Creating a polygon with Two.makePolygon does not set the x and y coordinates of the shape. This fix addresses this issue.

Steps to reproduce.

const params = {
  width: 300,
  height: 300,
}

const two = new Two(params).appendTo(document.getElementById('container'))

const polygon = two.makePolygon(150, 150, 100, 12)
two.update()

Actual Result

image

Expected Result

image

P.S. first time contributing.

jonobr1 commented 2 years ago

Thanks for this! This slipped through the cracks when converting the latest functions and documentation to TypeScript types.