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.

Scroll parent document with mouse wheel

Home Forums Puzzles Scroll parent document with mouse wheel

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #21789
    Branden Coker
    Customer

    I have an orbit camera set to a fixed distance. My scene can be rotated but doesn’t allow zooming. When I use my scroll wheel in my browser I would like the page to scroll, but currently nothing happens. Is there a way scroll the page with the wheel when it isn’t needed for zooming?

    #21832

    Hi Brandon,

    This can be solved only by using javascript API. It’s a simple code snippet, which you can add for example in the standard runCode() function in your application’s js file:

    
    function runCode(app) {
    
        if (app.controls) {
            app.controls.enableZoom = false;
        }
    
    }
    

    – this should completely disable zoom and bring page scrolling back

    Co-founder and lead developer at Soft8Soft.

    #21850
    Branden Coker
    Customer

    Thank you, Ivan. I tried adding that to my JS file. It worked initially when my page first loads. However, when user interaction causes a switch to a flying camera with locked rotation and movement, the scroll becomes locked again. I tried calling my JS function each time the camera changes, but that didn’t seem to work. User can never scroll the window when viewing through a flying camera.

    #21864

    However, when user interaction causes a switch to a flying camera with locked rotation and movement, the scroll becomes locked again.

    Oh, yes it’s a bug with the Flying camera. We’ll fix that in the upcoming verge3d release which will happen in 1 or 2 weeks.

    As for now, one possible workaround is to disable the controls completely when you switch to a flying camera, for example like this:

    
    if (app.controls) {
        app.controls.enabled = false;
    }
    

    – this way it won’t lock the scroll, but the camera will not react to any user input either.

    Co-founder and lead developer at Soft8Soft.

    #21872
    Branden Coker
    Customer

    Thank you Ivan. I’m actually using my flying camera to tween to locked positions around the scene, so this works perfectly!

    #49344
    ma77hew
    Participant

    Hi Brandon,

    This can be solved only by using javascript API. It’s a simple code snippet, which you can add for example in the standard runCode() function in your application’s js file:

    
    function runCode(app) {
    
        if (app.controls) {
            app.controls.enableZoom = false;
        }
    
    }
    

    – this should completely disable zoom and bring page scrolling back

    @ Ivan Lyubovnikov

    I have followed your directions this to prevent my parent document from scrolling. However, now my pointerlock controls of W and D to move my camera forward and backward have been disabled as well. Why is this happening?

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