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

Should CanvasElement height and width return floats? #101

Open tom-sherman opened 2 years ago

tom-sherman commented 2 years ago

Seems like a pretty nuts use case to have a canvas with a greater height or width than ~2million but I think it's possible.

Maybe this applies in other places too? I think in general most of the web APIs should return floats as they map to JS numbers.

TheSpyder commented 2 years ago

The main use case I see for floats in the DOM is not large numbers, but fractions. Setting a fractional pixel isn’t common but having them returned by measurement apis can be.

so it’s not a no, but I’d prefer to see use case examples before changing an int to a float 🤔

tom-sherman commented 2 years ago

Good points. I'm thinking more about the bindings be as spec compliant as possible - where the spec defines a JS number I think it makes sense to use a float without really needing to think about the use cases.