Skip to content

[Refactor] Scrolling to zoom in scenario_dag should disable page scroll #2804

@arcanaxion

Description

@arcanaxion

📌 Description

Scrolling to zoom in/out of a scenario_dag still scrolls the page at the same time, making it very difficult to use.

Example:

import taipy as tp
import taipy.gui.builder as tgb
from taipy import Config, Gui


def square(x: int) -> int:
    return x**2


x_xfg = Config.configure_data_node(id="x", default_data=5)
y_xfg = Config.configure_data_node(id="y")
square_task_cfg = Config.configure_task(id="square", function=square, input=x_xfg, output=y_xfg)
scenario_cfg = Config.configure_scenario(id="scenario", task_configs=[square_task_cfg])

selected_scenario = None
selected_data_node = None
selected_job = None

def on_init(state):
    # state.selected_scenario = tp.get_scenarios()[0]
    ...

with tgb.Page() as page:
    with tgb.part(class_name="container"):
        tgb.toggle(theme=True)
        tgb.text("# Basic Example", mode="md")
        with tgb.layout(columns="1 1"):
            with tgb.part(class_name="card mb1"):
                tgb.text("## Select scenario:", mode="md")
                tgb.scenario_selector("{selected_scenario}")
                tgb.scenario("{selected_scenario}")
            with tgb.part(class_name="card mb1"):
                tgb.text("## Select data node:", mode="md")
                tgb.data_node_selector("{selected_data_node}")
                tgb.data_node("{selected_data_node}")
        with tgb.part(class_name="card mb1"):
            tgb.text("## Jobs", mode="md")
            tgb.job_selector()
        with tgb.expandable("Scenario DAG"):
            tgb.scenario_dag("{selected_scenario}", show_toolbar=False)

if __name__ == "__main__":
    Config.configure_job_executions(mode="standalone")
    tp.Orchestrator().run()
    tp.create_scenario(scenario_cfg, name="My Scenario").submit()
    Gui(page=page).run(title="Scroll in scenario_dag does not disable page scroll")

For some reason, if you uncomment the line in on_init, the scenario_dag does actually disable page scroll

📜 Code of Conduct

  • I have checked the existing issues to avoid duplicates.
  • I am willing to work on this issue (optional)

✅ Acceptance Criteria

  • The refactored code maintains existing functionality without breaking changes.
  • Any new code is covered by unit tests.
  • Code coverage remains at least 90%.
  • Performance improvements are documented, if applicable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions