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.

Event listener on the whole browser

Home Forums Puzzles Event listener on the whole browser

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #63325
    Webenart
    Customer

    hi,

    i set that puzzle for the mouse to follow the cursor, it works, but it does only inside the v3d-container, i need the mouse event to happen on the whole browser,. not just on the verge3d container.

    i tried:

    “document”,
    “window”.
    and “body”

    it supposes to work with document option, also tried the “in parent doc” but no difference. it works only when the cursor is inside the v3d-container.

    I implement the verge3d project by adding to the container i need the id “v3d-container” on a wordpress website . No iframe, no index file etc.

    regards

    Webenart | Creative Websites
    webenart.com

    #63326
    kdv
    Participant

    it works, but it does only inside the v3d-container

    that’s because only v3d-container has an event listener to read the screen coordinates.
    read hear https://www.soft8soft.com/topic/move-head-animation-by-moving-the-mouse-2/

    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.

    #63327
    Webenart
    Customer

    Hi,

    So i tried it,

    const xNorm = event.offsetX / event.target.clientWidth;
    const yNorm = event.offsetY / event.target.clientHeight;
    VARS.pGlob.screenCoords.x = xNorm * 2 – 1;
    VARS.pGlob.screenCoords.y = -yNorm * 2 + 1;

    indeed i get movement outside of v3d-container, that’s a good start, but when the mouse got from the v3d-container to the parent container the movement of the 3d object it is way larger than inside the container, and its sudden, it is noticable that you are getting out of the container with the cursor, bcs the object “jumps” to a different location, like the center changes.

    I tried a few different parent containers for the possibility there is an issue with the one i chose, still the same.

    regards

    Webenart | Creative Websites
    webenart.com

    #63328
    kdv
    Participant

    Well, now that’s your quest. You need to figure out how to block the event listener in v3d-container and read the screen coordinates from the parent window only…

    the object “jumps” to a different location, like the center changes.

    that’s because the center is really changed…

    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.

    #63329
    Webenart
    Customer

    Unfortunately i have not the skills to do that, thanks for the help anyway :)

    Webenart | Creative Websites
    webenart.com

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