mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
fix: Ensure that Playwright tile height is always positive (#36027)
(cherry picked from commit 728bc2c632)
This commit is contained in:
committed by
Joe Li
parent
d8c8430ed7
commit
3b7a52d1eb
@@ -151,12 +151,28 @@ def take_tiled_screenshot(
|
||||
remaining_content = dashboard_height - tile_start_in_element
|
||||
tile_content_height = min(viewport_height, remaining_content)
|
||||
|
||||
# Determine clip height (use visible element height in viewport)
|
||||
clip_height = min(tile_content_height, current_element_box["height"])
|
||||
|
||||
# Skip tile if dimensions are invalid (width or height <= 0)
|
||||
# This can happen if element is completely scrolled out of viewport
|
||||
if clip_height <= 0:
|
||||
logger.warning(
|
||||
"Skipping tile %s/%s due to invalid clip dimensions: "
|
||||
"width=%s, height=%s (element may be scrolled out of viewport)",
|
||||
i + 1,
|
||||
num_tiles,
|
||||
current_element_box["width"],
|
||||
clip_height,
|
||||
)
|
||||
continue
|
||||
|
||||
# Clip to capture only the current tile portion of the element
|
||||
clip = {
|
||||
"x": current_element_box["x"],
|
||||
"y": current_element_box["y"],
|
||||
"width": current_element_box["width"],
|
||||
"height": min(tile_content_height, current_element_box["height"]),
|
||||
"height": clip_height,
|
||||
}
|
||||
|
||||
# Take screenshot with clipping to capture only this tile's content
|
||||
|
||||
Reference in New Issue
Block a user