Skip to content

Issue with mouse events supported by the listeners property #51

@Brandon-Xu

Description

@Brandon-Xu

https://github.com/Kitware/trame-vtklocal/blob/master/examples/vtk/actor_picker.py

In this example, I only changed the

 view.listeners = (
    "wasm_listeners",
    {
        wasm_interactor_id: {
            "LeftButtonPressEvent": {
                "clicked_pos": {
                    "x": (wasm_interactor_id, "EventPosition", 0),
                    "y": (wasm_interactor_id, "EventPosition", 1),
                },
            },
        },
    },
)

to

 view.listeners = (
    "wasm_listeners",
    {
        wasm_interactor_id: {
            "LeftButtonReleaseEvent": {
                "clicked_pos": {
                    "x": (wasm_interactor_id, "EventPosition", 0),
                    "y": (wasm_interactor_id, "EventPosition", 1),
                },
            },
        },
    },
)

and found that it did not work.

Because I noticed that triggering immediately upon left-click conflicts with the operation of dragging in the 3D scene, I want the trigger to happen upon left-button release. Additionally, I plan to compare the recorded position at the time of the click. If the movement exceeds a certain distance, it will be considered a drag rather than a click, which can help avoid accidental triggers. However, the left-button release event is not being detected, making it impossible to implement this feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions