Open topic with navigation

# Mouse Emulation API

## Detailed Description

These functions allow any tracker target to emulate a mouse.

## List of Functions
ZSError | zsSetMouseEmulationEnabled (ZSContext context, ZSBool isEnabled)
ZSError | zsIsMouseEmulationEnabled (ZSContext context, ZSBool* isEnabled)
ZSError | zsSetMouseEmulationTarget (ZSContext context, ZSHandle targetHandle)
ZSError | zsGetMouseEmulationTarget (ZSContext context, ZSHandle* targetHandle)
ZSError | zsSetMouseEmulationMovementMode (ZSContext context, ZSMouseMovementMode movementMode)
ZSError | zsGetMouseEmulationMovementMode (ZSContext context, ZSMouseMovementMode* movementMode)
ZSError | zsSetMouseEmulationMaxDistance (ZSContext context, ZSFloat maxDistance)
ZSError | zsGetMouseEmulationMaxDistance (ZSContext context, ZSFloat* maxDistance)
ZSError | zsSetMouseEmulationButtonMapping (ZSContext context, ZSInt32 buttonId, ZSMouseButton mouseButton)
ZSError | zsGetMouseEmulationButtonMapping (ZSContext context, ZSInt32 buttonId, ZSMouseButton* mouseButton)
## List of Enumerations
enum | ZSMouseButton { ZS_MOUSE_BUTTON_UNKNOWN = -1, ZS_MOUSE_BUTTON_LEFT = 0, ZS_MOUSE_BUTTON_RIGHT = 1, ZS_MOUSE_BUTTON_CENTER = 2 }
enum | ZSMouseMovementMode { ZS_MOUSE_MOVEMENT_MODE_ABSOLUTE = 0, ZS_MOUSE_MOVEMENT_MODE_RELATIVE = 1 }

## Function Descriptions

ZSError zsGetMouseEmulationButtonMapping | ( | ZSContext | context,
|  | ZSInt32 | buttonId,
|  | ZSMouseButton* | mouseButton
| ) |  |

Gets the currently mapped mouse button for the specified tracker target button.

Parameters:

  [in] | context | A handle to the internal state of the zSpace SDK.
  [in] | buttonId | The button on the tracker target.
  [out] | mouseButton | The currently mapped button on a mouse.

ZSError zsGetMouseEmulationMaxDistance | ( | ZSContext | context,
|  | ZSFloat* | maxDistance
| ) |  |

Gets the maximum distance that the tracker target can be from the display while emulating the mouse.

Parameters:

  [in] | context | A handle to the internal state of the zSpace SDK.
  [out] | maxDistance | The maximum distance in meters.

ZSError zsGetMouseEmulationMovementMode | ( | ZSContext | context,
|  | ZSMouseMovementMode* | movementMode
| ) |  |

Gets the mouse emulation's current movement mode.

Parameters:

  [in] | context | A handle to the internal state of the zSpace SDK.
  [out] | movementMode | The current setting for mouse movement.

ZSError zsGetMouseEmulationTarget | ( | ZSContext | context,
|  | ZSHandle* | targetHandle
| ) |  |

Gets the tracker target that is responsible for emulating the mouse.

Parameters:

  [in] | context | A handle to the internal state of the zSpace SDK.
  [out] | targetHandle | A handle to the tracker target.

ZSError zsIsMouseEmulationEnabled | ( | ZSContext | context,
|  | ZSBool* | isEnabled
| ) |  |

Checks whether mouse emulation is enabled.

Parameters:

  [in] | context | A handle to the internal state of the zSpace SDK.
  [out] | isEnabled | True if enabled, false otherwise.

ZSError zsSetMouseEmulationButtonMapping | ( | ZSContext | context,
|  | ZSInt32 | buttonId,
|  | ZSMouseButton | mouseButton
| ) |  |

Maps a button on the tracker target to a mouse button.

Parameters:

  [in] | context | A handle to the internal state of the zSpace SDK.
  [in] | buttonId | The button on the tracker target.
  [in] | mouseButton | The corresponding button on a mouse.

Example:

       ZSContext context = ...;

       zsSetMouseEmulationButtonMapping(context, 0, ZS_MOUSE_BUTTON_LEFT);

ZSError zsSetMouseEmulationEnabled | ( | ZSContext | context,
|  | ZSBool | isEnabled
| ) |  |

Enables or disables mouse emulation.

Parameters:

  [in] | context | A handle to the internal state of the zSpace SDK.
  [in] | isEnabled | True to enable emulation, false otherwise.

ZSError zsSetMouseEmulationMaxDistance | ( | ZSContext | context,
|  | ZSFloat | maxDistance
| ) |  |

Sets the maximum distance that the tracker target can be from the display while emulating the mouse.

Parameters:

  [in] | context | A handle to the internal state of the zSpace SDK.
  [in] | maxDistance | The maximum distance in meters.

ZSError zsSetMouseEmulationMovementMode | ( | ZSContext | context,
|  | ZSMouseMovementMode | movementMode
| ) |  |

Sets the mouse emulation's movement mode to absolute or relative. This function determines how mouse emulation behaves when both the mouse and stylus are used. Refer to ZSMouseMovementMode for details.

Parameters:

  [in] | context | A handle to the internal state of the zSpace SDK.
  [in] | movementMode | Movement is either absolute or relative to the mouse's current position.

ZSError zsSetMouseEmulationTarget | ( | ZSContext | context,
|  | ZSHandle | targetHandle
| ) |  |

Assigns a tracker target that will emulate the mouse.

Parameters:

  [in] | context | A handle to the internal state of the zSpace SDK.
  [in] | targetHandle | A handle to the tracker target.

Example:

       ZSContext context = ...;

       // Get the stylus target.
       ZSHandle stylusHandle =  NULL;
       zsFindTargetByType(context, ZS_TARGET_TYPE_PRIMARY, 0, &stylusHandle);

       // Set mouse emulation enabled.
       zsSetMouseEmulationEnabled(true);

       // Assign the target that will emulate the mouse.
       zsSetMouseEmulationTarget(context, stylusHandle);

## Enumeration Descriptions

enum ZSMouseButton

Defines mouse buttons to be used when mapping a tracker target's buttons to a mouse.

Enumerator:

  ZS_MOUSE_BUTTON_UNKNOWN |
  ZS_MOUSE_BUTTON_LEFT |
  ZS_MOUSE_BUTTON_RIGHT |
  ZS_MOUSE_BUTTON_CENTER |

enum ZSMouseMovementMode

Determines how the stylus and mouse control the cursor when both are used.

Enumerator:

  ZS_MOUSE_MOVEMENT_MODE_ABSOLUTE | The stylus uses absolute positions. In this mode, the mouse and stylus can fight for control of the cursor if both are in use. This is the default mode.
  ZS_MOUSE_MOVEMENT_MODE_RELATIVE | The stylus applies delta positions to the mouse cursor's current position. Movements by the mouse and stylus are compounded without fighting.

Open topic with navigation