rescript-webapi icon indicating copy to clipboard operation
rescript-webapi copied to clipboard

Should CanvasElement height and width return floats?

Open tom-sherman opened this issue 3 years ago • 2 comments

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.

tom-sherman avatar Jun 12 '22 10:06 tom-sherman

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 🤔

TheSpyder avatar Jun 13 '22 09:06 TheSpyder

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.

tom-sherman avatar Jun 13 '22 10:06 tom-sherman