TheSpyder / rescript-webapi

ReScript bindings to the DOM and other Web APIs
http://tinymce.github.io/rescript-webapi/api/Webapi/
Other
149 stars 36 forks source link

Path2D as Module? #132

Open utenma opened 2 months ago

utenma commented 2 months ago

Example of path2D as currently

let path: path2d = newPath2D("M24.85,10.126c2.018-4.783,6.628-8.125,11.99-8.125c7.223")
ctx->beginPath
ctx->strokePath2D(path)
ctx->fillPath2D(path)

After working with react rescript bindings would expect Path2D to be it's own module like

let path: path2d = Path2D.make("M24.85,10.126c2.018-4.783,6.628-8.125,11.99-8.125c7.223")
ctx->beginPath
ctx-> Path2D.stroke(path)
ctx-> Path2D.fill(path)

That would be a breaking change, however Path2D bindings seems currently on an early stage

Would a PR with those changes be accepted?

If so, would be possible to add all remaining Path2D method bindings to that module

Path2D.addPath() Path2D.closePath() Path2D.moveTo() Path2D.lineTo() Path2D.bezierCurveTo() Path2D.quadraticCurveTo() Path2D.arc() Path2D.arcTo() Path2D.ellipse() Path2D.rect() Path2D.roundRect()

TheSpyder commented 2 months ago

Because it was contributed that way in #45 🤷‍♂️

Yes, I'd accept a PR to add a new module. I am a couple of years overdue for publishing a 1.0 release, that seems like a good breaking change to have

TheSpyder commented 1 month ago

you didn't need to close this - your PR would automatically close it when merged.

utenma commented 1 month ago

may add more canvas tests