MCPcopy Index your code
hub / github.com/plotly/dash / zoom_in_graph_by_ratio

Method zoom_in_graph_by_ratio

dash/testing/browser.py:589–610  ·  view source on GitHub ↗

Zoom out a graph with a zoom box fraction of component dimension default start at middle with a rectangle of 1/5 of the dimension use `compare` to control if we check the svg get changed.

(
        self, elem_or_selector, start_fraction=0.5, zoom_box_fraction=0.2, compare=True
    )

Source from the content-addressed store, hash-verified

587 ).perform()
588
589 def zoom_in_graph_by_ratio(
590 self, elem_or_selector, start_fraction=0.5, zoom_box_fraction=0.2, compare=True
591 ):
592 """Zoom out a graph with a zoom box fraction of component dimension
593 default start at middle with a rectangle of 1/5 of the dimension use
594 `compare` to control if we check the svg get changed."""
595 elem = self._get_element(elem_or_selector)
596
597 prev = elem.get_attribute("innerHTML")
598 w, h = elem.size["width"], elem.size["height"]
599 try:
600 ActionChains(self.driver).move_to_element_with_offset(
601 elem, w * start_fraction, h * start_fraction
602 ).drag_and_drop_by_offset(
603 elem, w * zoom_box_fraction, h * zoom_box_fraction
604 ).perform()
605 except MoveTargetOutOfBoundsException:
606 logger.exception("graph offset outside of the boundary")
607 if compare:
608 assert prev != elem.get_attribute(
609 "innerHTML"
610 ), "SVG content should be different after zoom"
611
612 def click_at_coord_fractions(self, elem_or_selector, fx, fy):
613 elem = self._get_element(elem_or_selector)

Callers

nothing calls this directly

Calls 1

_get_elementMethod · 0.95

Tested by

no test coverage detected