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.

How to access the onWindowResize function in Verge3D?

Home Forums Programming How to access the onWindowResize function in Verge3D?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #77359
    Ignacio Díaz
    Customer

    Hello Verge3D community,
    I was wondering if there is a built-in method that automatically handles window resizing. Specifically, I want to check if there’s a way to directly access or reference the function. Here is the context code:

    onWindowResize();
    
    if ('ontouchstart' in window) {
        document.addEventListener('touchmove', move);
    } else {
        window.addEventListener('resize', onWindowResize, false);
        document.addEventListener('mousemove', move);
    }
    

    Thank you for your guidance!
    Best regards,
    Ignacio

    #77397

    Hi Ignacio,

    You can use the following code to override the built-in app.onResize() function:

    const onResizeOld = app.onResize;
    
    app.onResize = function() {
        onResizeOld.call(app);
        // place your code here
        console.log("Resized!");
    }

    Same with Puzzles:

    Attachments:
    You must be logged in to view attached files.

    Soft8Soft Tech Chief
    X | FB | LinkedIn

    #77517
    Ignacio Díaz
    Customer

    Thanks a lot for your quick response and for clarifying that I can override the built-in app.onResize() function. This will help me streamline my code!

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