Vizard 7 » Command Index » Vizard objects » node3d » <node3d:canvas>.setMouseStyle
7.6

<node3d:canvas>.setMouseStyle

Set the canvas mouse style

<node3d:canvas>.setMouseStyle(  
style  
mode = viz.MASK_SET  
)  
style
A combination of the following canvas mouse style flags:

Style

Description

viz.CANVAS_MOUSE_BUTTON

The canvas will respond to real mouse button events.

viz.CANVAS_MOUSE_MOVE

The canvas will respond to real move move events to move the virtual canvas cursor.

viz.CANVAS_MOUSE_POSITION

The canvas will use the real mouse position when responding to real mouse button events, instead of the virtual canvas cursor position.

viz.CANVAS_MOUSE_VISIBLE

The canvas will display the virtual cursor.

viz.CANVAS_MOUSE_VIRTUAL

Use a virtual cursor for interacting with the canvas. This flag is an alias for (viz.CANVAS_MOUSE_BUTTON | viz.CANVAS_MOUSE_MOVE | viz.CANVAS_MOUSE_VISIBLE).

viz.CANVAS_MOUSE_REAL

Use the real mouse cursor for interacting with the canvas. This flag is an alias for (viz.CANVAS_MOUSE_BUTTON | viz.CANVAS_MOUSE_POSITION).

mode = viz.MASK_SET
Mode for specifying how to apply the mask. Can be one of the following:

Mask modes

viz.MASK_SET

Set the mask to the new value.

viz.MASK_ADD

Add the value to the existing mask.

viz.MASK_REMOVE

Remove the value from the existing mask.

viz.MASK_TOGGLE

Toggle the value with the existing mask.

Remarks

This command sets the mouse interaction style for the canvas. The two common styles are viz.CANVAS_MOUSE_REAL and viz.CANVAS_MOUSE_VIRTUAL.

viz.CANVAS_MOUSE_REAL will use the actual mouse position and button events to interact with GUI elements within the canvas. This is typically used in non-stereo desktop interaction modes.

viz.CANVAS_MOUSE_VIRTUAL will use the actual relative mouse movement events to move the virtual canvas cursor, but still respond to actual mouse button events. This is typically used in sit down stereo/HMD scenarios, where a user is viewing the scene in stereo, but still using the mouse to interact. This mode is commonly used in conjunction with the <node3d:canvas>.setRenderWorldOverlay render mode. You will most likely want to hide the real mouse cursor and trap it within the graphics window when using this mode (<viz:mouse>.setVisible(False) and <viz:mouse>.setTrap(True)).

When using a custom input device to interact with the canvas, it is common to set the style to viz.CANVAS_MOUSE_VISIBLE, meaning all real mouse events are ignored, but the virtual cursor is still displayed. This is common for stand-up/walking HMD/cave setups, where the participant is using a joystick or wand device to interact with the GUI elements. You will need to use the <node3d:canvas>.setCursorPosition and <node3d:canvas>.sendMouseButtonEvent commands to manually position the virtual cursor and simulate button presses.

The default mouse style is viz.CANVAS_MOUSE_REAL.

Return Value

None

See also

<node3d:canvas>.getMouseStyle
<node3d:canvas>.getCursorPosition
<node3d:canvas>.setCursorPosition
<node3d:canvas>.getCursorMoveScale
<node3d:canvas>.setCursorMoveScale
<node3d:canvas>.sendMouseButtonEvent
<node3d:canvas>.setRenderScreenOrtho
<node3d:canvas>.setRenderScreenPerspective
<node3d:canvas>.setRenderWorld
<node3d:canvas>.setRenderWorldOverlay
<viz:mouse>.setTrap
<viz:mouse>.setVisible