I figured out my problem. Basically, the API has an expected chain of mouse interaction requests:

When zooming:
1 - (fired when ctrl+right-mouse is pressed)
/action/: down
/states/: buttonRight and ctrlKey should be true
/y/: should be the current, normalized zoom (something between 0 and 1)
2 - (fired when mouse moves along y-axis)
/action/: move
/states/: buttonRight and ctrlKey should be true
/y/: should be the current, normalized zoom based on the change in y
3 - (fired when scrolling stops)
/action/: up
/states/: buttonRight and ctrlKey should be false this time
/y/: should be the current, normalized zoom

When rotating:
1 - (fired when left-mouse is pressed)
/action/: down
/states/: buttonLeft is true
/x,y/: should be the current cursor location, normalized
2 - (fired when mouse moves)
/action/: move
/states/: buttonLeft is true
/x,y/: should be the current cursor location, normalized
3 - (fired when left-mouse is released)
/action/: up
/states/: buttonLeft should be false this time
/x,y/: should be the current cursor location, normalized

As long as those requests take place in the right order, everything works as expected. Thanks for the clues, guys.

Jordan

Jordan Deyton
Oak Ridge National Laboratory
Telephone: (865) 574-1091
Email: [email protected]

On 7/2/2015 1:03 PM, Deyton, Jordan H. wrote:

I wasn't really sure what to use for the action.


(I will double check that I'm sending the full request with all parameters.) I'll try using "move" instead of "none". I'll also try programmatically sending a very small mouse movement with the left click, and report back if I can find anything out.


Thanks!

Jordan


------------------------------------------------------------------------
*From:* Sebastien Jourdain <[email protected]>
*Sent:* Wednesday, July 01, 2015 7:09 PM
*To:* Scott Wittenburg
*Cc:* Deyton, Jordan H.; [email protected]
*Subject:* Re: [Paraview] Zooming through the ParaViewWeb API
Scott is right, the x,y values are normalized, so depending on your screen size if your image is 1000 pixel wide and you want to reflect a move of 10 pixel, you should send a x of 10/1000=0.01.

On Wed, Jul 1, 2015 at 4:28 PM, Scott Wittenburg <[email protected] <mailto:[email protected]>> wrote:

    Here is a sample from my websocket frames just now:

    
[48,4996973606207488,{},"viewport.mouse.interaction",[{"view":353,"action":"move","altKey":false,"ctrlKey":false,"shiftKey":false,"metaKey":false,"buttonLeft":false,"buttonMiddle":false,"buttonRight":true,"x":0.7654596100278551,"y":0.38173817381738173}]]


    It seems the "action" should be set to "move" rather than "none",
    as in the documentation you linked, "none" does not seem to be an
    option.  Also, as that documentation states, x and y should be
    normalized to [0, 1], as you correctly guessed.  And finally, you
    may need to provide all the parameters with values like I show
    above, not just the ones you are interested in.

    But at any rate, this should not then affect the center of
    rotation, but it sounds like in your case maybe it is?  Can you
    see if moving just a *tiny* bit keeps at least some of the object
    in view?

    Cheers,
    Scott


    On Wed, Jul 1, 2015 at 4:12 PM, Jordan Deyton <[email protected]
    <mailto:[email protected]>> wrote:

        ParaViewWeb gurus,

        Is there a correct way to send a zoom request through the
        ParaViewWeb API?

        I'm especially looking at the PVW MouseHandler (documentation
        here --
        
http://www.paraview.org/ParaView3/Doc/Nightly/www/js-doc/index.html#!/api/protocols.ParaViewWebMouseHandler
        
<http://www.paraview.org/ParaView3/Doc/Nightly/www/js-doc/index.html#%21/api/protocols.ParaViewWebMouseHandler>)

        I have had some success by sending a right-click with a small
        y value (looks like it needs to be between 0 and 1), the
        action set to "none", and buttonRight set to "true". However,
        when I afterward rotate the view (using the same RPC call with
        different methods), the rendered object just vanishes,
        although the axes and legend are still there.

        Jordan

-- Jordan Deyton
        Oak Ridge National Laboratory
        Telephone: (865) 574-1091 <tel:%28865%29%20574-1091>
        Email: [email protected] <mailto:[email protected]>

        _______________________________________________
        Powered by www.kitware.com <http://www.kitware.com>

        Visit other Kitware open-source projects at
        http://www.kitware.com/opensource/opensource.html

        Please keep messages on-topic and check the ParaView Wiki at:
        http://paraview.org/Wiki/ParaView
        <http://paraview.org/Wiki/ParaView>

        Search the list archives at:
        http://markmail.org/search/?q=ParaView
        <http://markmail.org/search/?q=ParaView>

        Follow this link to subscribe/unsubscribe:
        http://public.kitware.com/mailman/listinfo/paraview



    _______________________________________________
    Powered by www.kitware.com <http://www.kitware.com>

    Visit other Kitware open-source projects at
    http://www.kitware.com/opensource/opensource.html
    <http://www.kitware.com/opensource/opensource.html>

    Please keep messages on-topic and check the ParaView Wiki at:
    http://paraview.org/Wiki/ParaView <http://paraview.org/Wiki/ParaView>

    Search the list archives at:
    http://markmail.org/search/?q=ParaView
    <http://markmail.org/search/?q=ParaView>

    Follow this link to subscribe/unsubscribe:
    http://public.kitware.com/mailman/listinfo/paraview




_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

Reply via email to