We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

get the size of the canvas

Home Forums General Questions get the size of the canvas

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #72202
    tomtm
    Participant

    Hello,

    To find out whether the application is operated in landscape or portrait mode, I want to read the height and width of the canvas. However, I always get undefined back.

    I have added the scene which I try to get the width. I think the name of the canvas must be different.

    Greets Tom

    https://www.ayashmi.com/Get_Size.zip

    • This topic was modified 3 weeks ago by tomtm.
    • This topic was modified 3 weeks ago by tomtm.
    • This topic was modified 3 weeks ago by tomtm.
    Attachments:
    You must be logged in to view attached files.
    #72207
    kdv
    Participant

    <div> or <canvas> have no property named “width”. But they have several other properties:

    usually window.innerHeight and window.innerWidth are used in three.js and v3d.js to set the canvas size.

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #72211
    tomtm
    Participant

    Hi kdv

    Yes, offset seems to work.
    Thanks a lot.

    I couldn’t see this parameter in the developer tools tab of edge.

    Tom

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.