Skip to content

Add a repeat flag in the binding API #2082

Open
@Denys619

Description

@Denys619

Is your feature request related to a problem? Please describe.
The binding API let libf3d user defines bindings to interact with, however most of these bindings should not support being repeated. Lets add a control for that

Describe the solution you'd like

  • Add a repeat arg to the binding API
  • Implement the feature of not repeating input
  • Add doc and tests

Context
Original issue: Input command toggles repeatedly when key is held down #2082

Description
When pressing and holding down keys bound to toggle commands (such as toggling the axis visibility ui.axis or other boolean settings), the command rapidly switches its state (on/off/on/off). This causes performance issues, UI flickering, and makes the interaction unpleasant.

To Reproduce
Steps to reproduce the behavior:

  1. Launch F3D.
  2. Press and hold a key bound to a toggle command (e.g., axis visibility).

Expected behavior
When a toggle key is pressed and held, the state of the command should change only once. Holding the key should not trigger repetitive state changes.

System Information:

  • OS: Ubuntu Linux (24.04.2)
  • F3D: Latest master branch (commit hash 9e9123ec760ad0f465e76a5cf1b9b46baf3bd7eb)

F3D Information

Version: 3.0.0-146-g9e9123ec.
Build date: 2025-03-21 18:50:31.
Build system: Linux 64-bits.
Compiler: GNU 13.3.0.
Module ImGui: ON.
Module OpenEXR: OFF.
Module Raytracing: OFF.
VTK version: 9.4.1.

Additional context
The key input handling in vtkF3DImguiObserver triggers repeated KeyPress events without checking if the key is already pressed, causing the command to be continuously executed.

I've attempted a preliminary solution by using a keyState map to prevent repeated toggling, but it didn't fully resolve the issue. A more robust approach may be needed at the input handling or event propagation level.

Demonstration
I've attached a short video demonstrating this issue clearly.

Screencast.from.2025-03-22.08-55-43.webm

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Discuss

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions