guidocioni / point_wx

4 stars 0 forks source link

Introduce delay in scrolling to plot #112

Closed guidocioni closed 3 months ago

guidocioni commented 4 months ago

To avoid interruptions

Example

clientside_callback(
    """
    function(n_clicks, element_id) {
            var targetElement = document.getElementById(element_id);
            if (targetElement) {
                setTimeout(function() {
                    targetElement.scrollIntoView({ behavior: 'smooth' });
                }, 500); // in milliseconds
            }
        return null;
    }
    """,
    Output("garbage", "data", allow_duplicate=True),
    Input("intermediate-value-point", "data"),
    [State("time-plot-point", "id")],
    prevent_initial_call=True,
)

In theory we can trigger this already when the button is pressed and not only when the plot is ready!

guidocioni commented 3 months ago

Changed in faf48a67eae39783be1befdb847006b6a0073a7b