GUI Controls Initialization

User manual of the trinckle paramate GUI Controls API.

Connecting to Open Parameters

The initialization of GUI controls in the paramate GUI Controls API involves establishing communication with the paramate server and configuring the controls with open parameter strings or initial control values. These initialization approaches enable direct responses from the trCAD system or provide a starting point for further interaction and manipulation. With the ability to adapt to different open parameter strings and initial values, the GUI controls offer flexibility and simple integration within trinckle paramate configurator web applications.

1. Initialization with Open Parameter String

GUI controls in the paramate GUI Controls API communicate with the paramate server by utilizing the open parameters of the underlying 3D model. These open parameters serve as the bridge between the controls and the trinckle trCAD system, enabling real-time responses. The open parameter string serves as a unique identifier for the specific control and the associated 3D model or list of models. It contains information about the parameters and configurations required for the control to function properly.

2. Initialization with Initial Control Value

In cases where an open parameter string is not provided, users have the option to initialize the control with an initial value. This initial value acts as the starting point for the control, allowing users to set an initial state without a direct response from the trCAD system.

By specifying an initial value, users can predefine the control's configuration or position, providing a starting point for further interaction and manipulation. However, without the open parameter string and direct connection to the trCAD system, the control may not reflect real-time changes or receive immediate responses from the underlying 3D model.

It's important to note that the open parameter string and initial control value differ for each GUI control. The specific content and structure of the open parameter string and initial value depend on the requirements and functionality of the particular control.

The paramate GUI Controls API is designed to automatically detect whether the open parameter string refers to a single 3D model or a list of models. This versatility allows for seamless integration with various configurations and scenarios, adapting to the specific data passed to the controls.

Customizing Controls

Controls customization within the paramate GUI Controls API allows for flexible tailoring of each control's behavior, appearance, and functionality based on specific settings and requirements. While all controls share a common API for core functionalities related to HTML Canvas (e.g., the radius and color of the point, the thickness and color of the line, etc.), each control type has its unique customization options. Generic customization, such as look and feel adjustments, can be achieved through setters, providing a convenient way to modify common properties across all controls.

On the other hand, specific look and feel customization, like handle sizes, rotation steps, or scaling options for TransformGizmo Control, can be achieved using options objects tailored to each control type. This extensive customization capability empowers developers to create highly tailored user interfaces that easily integrate with the trinckle paramate configurator web applications, enabling an intuitive user experience.

Users can create a list of custom styling presets, each defining specific styling configurations for the Canvas HTML elements within the paramate GUI Controls API. By defining presets, users can switch between different visual themes or configurations, simplifying the process of creating unique and visually appealing controls.

The following setters can be used across all GUI Controls Objects:

  • ref_pointStyles_setter - ref_fillStyles_setter - ref_fontStyles_setter - ref_lineStyles_setter

For the list of custom settings for each control please consult the page of the control.

Changing Control Events

The paramate GUI Controls API offers the possibility to add user-defined callback functions that are triggered during specific events in the configuration process. These custom events allow users to enhance the default behavior of the controls or introduce custom behaviors tailored to their specific needs. For the list of user-defined callback functions and their sequence, see GUI controls user events

Setting Callbacks

The setCallbacks function is provided to set, unset, or dynamically change the callbacks during the lifetime of an GUI control object. To unset a callback function, the respective value is set to undefined.

Note

The setCallbacks() function may lead to race conditions between the initialization of the callbacks and early events that have already taken place. It is recommended to carefully consider the appropriate timing for calling setCallbacks() to ensure consistent and expected behavior.

Key Events

In addition to custom callback events, the paramate GUI Controls API allows to add user-defined key handlers to the controls. These key handlers are invoked when a keydown or keyup event occurs. By defining key handlers, users can create custom behaviors and responses to specific keyboard interactions. The following information outlines the key event capabilities within the GUI Controls API:

Adding Key Handlers

Users can add custom key handlers to the controls by registering them for specific key events. When a keydown or keyup event occurs, the corresponding key handler function is called, allowing users to define custom logic and actions. Key handlers provide the flexibility to respond to specific keyboard inputs in a way that aligns with the desired behavior of the control.

Removing Key Handlers

The paramate GUI Controls API also allows for the removal of key events from the list of registered key handlers. This can be useful when users want to selectively disable or modify certain key interactions for a control. By removing specific key events, users can customize the behavior of the control to better suit their application's requirements.

Default Key Events

Each control within the paramate GUI Controls API has a list of default key events documented specifically for that control. These default key events are pre-defined within the control to provide basic functionality or commonly expected behavior. Refer to the documentation for each control to understand the default key events associated with it and their corresponding functionalities.

Common API

The Common API section of the paramate GUI Controls provides a set of essential methods and properties that can be universally accessed and utilized across different types of advanced controls. The full list of the member functions and object accessors can be found under Common subgroup in the paramate GUI Controls API.