Git Product home page Git Product logo

Comments (6)

Kaiido avatar Kaiido commented on September 27, 2024

That was already brought in whatwg/html#5619 (comment) which didn't receive much returns, in either ways.
I wonder if this point shouldn't be brought again on the PR directly now.

FWIW, I personally don't have a strong opinion on this, with a small preference for a single Array, as I feel it is cleaner to have a single signature, and that very long signatures were actually not a great design decision (over the years I often wondered if having a dictionary for drawImage wouldn't have made it more friendly). If you are that much fighting against GC, I guess you could simply store that Array somewhere and reuse it every frame, like you probably already do with a lot of other objects.
But once again, these are not strong oppositions from my side.

from canvas2d.

fserb avatar fserb commented on September 27, 2024

I'm fine with it too.

@mysteryDate wdyt?

from canvas2d.

mysteryDate avatar mysteryDate commented on September 27, 2024

I've actually had this on my todo list for a while. I totally agree with a single number for ergonomic reasons, didn't think abuot the garbage collector.

from canvas2d.

Kaiido avatar Kaiido commented on September 27, 2024

@mysteryDate I just did update my polyfill to include this single radius option, however doing so I noticed that the current Chrome's implementation has some weird behavior with some stoopid inputs.

I'm not an IDL expert myself, but I believe that the JS value undefined should be converted to NaN by "unrestricted double" (I tested it with globalAlpha and indeed it is there, at least observably: the value did not change).
However, in roundRect undefined will be (observably) treated as 0: the rectangle will be drawn.
This is true for both roundRect(x, y, w, h, undefined) and roundRect(x, y, w, h, [undefined]).

Also the behavior of an Array as the first member of a list in radii seems similarly broken:
passing roundRect(x, y, w, h, [[20]]) treats radii as 0 (a rectangle with no rounded border is drawn), while if I'm not mistaken, [20] to unrestricted double should be 20.

Here is a fiddle with these observations you can check: https://jsfiddle.net/oxvqm597/
And here the same fiddle ran through my polyfill: https://jsfiddle.net/oxvqm597/1/

Could you please confirm that my reading is correct?

from canvas2d.

mysteryDate avatar mysteryDate commented on September 27, 2024

whatwg/html#7592
whatwg/html#7621

from canvas2d.

fserb avatar fserb commented on September 27, 2024

Closing this as we merged it! Thanks a lot for the feedback. :)

from canvas2d.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.