Seems when they load, all buttons are shown regardless of if the user is hovering over them or not. Then when hovering, they’re shown of course. Then moving the mouse away hides the buttons and it all works as normal. Seems unintended that it thinks the user is hovering onload when they’re not. Not sure why that’s happening.

(Also I don’t think it was happening until very recently. So possibly a breaking change.)

  • @perchanceM
    link
    English
    1
    edit-2
    3 months ago

    Ah okay solved it, thanks! It was due to some sort of update which changed the result of a touch screen detection heuristic. I’m now using window.matchMedia("(pointer: coarse)").matches which seems to work correctly. So the buttons should only show up (without hover) for phones, ipads, chromebooks in tablet mode (not in trackpad mode), etc.

    as the api gives a data url for the image anyway

    Yeah it’s just a convenience trade-off - it’s sometimes handy to have the canvas already ready to go, since that’s the first step in manipulating the image. Should be extremely minor in terms of performance unless you’re drawing dozens of images per second (I’d guess that even a few dozen per second on a mid-range mobile device would be fine, but I could be wrong).

    • @wthit56OP
      link
      English
      13 months ago

      Oh interesting! Didn’t know that was a media query! 👍

      Are people manipulating AI-generated images a lot then? I don’t think I’ve seen any generators that do that, but I guess I’m new here. And also, the people creating such generators already know how to do that pretty easily, so probably won’t have any problem doing it themselves anyhow.

      The other concern is memory use though. Phones might be fine with the processing cost, but a lot of phones still have low graphics RAM (if any). One idea would be to generate that through a getter, and cache the resulting canvas. That way there’s zero performance or memory usage unless the generator actually uses it. (Which as I say could be a very small percentage of image generators, potentially.) And those that do use it won’t be any the wiser, it being lazily created when needed.

      Personally I thought converting to data urls is pretty slow. Maybe for images at this comparatively small size it’s less of an issue.