mirror of
https://github.com/1j01/textual-paint.git
synced 2024-12-23 14:51:50 +03:00
Visualize tracks
This commit is contained in:
parent
599ec68b2b
commit
788d8389a2
@ -1301,6 +1301,17 @@ class AnsiArtDocument:
|
|||||||
break
|
break
|
||||||
# Sort tracks
|
# Sort tracks
|
||||||
tracks.sort(key=lambda track: track.min_center)
|
tracks.sort(key=lambda track: track.min_center)
|
||||||
|
# Visualize the tracks for debug
|
||||||
|
for track in tracks:
|
||||||
|
ET.SubElement(root, "{http://www.w3.org/2000/svg}rect", {
|
||||||
|
"x": str(track.min_center - min_rect_size / 2) if coord_attrib == "x" else "0",
|
||||||
|
"y": str(track.min_center - min_rect_size / 2) if coord_attrib == "y" else "0",
|
||||||
|
"width": str(min_rect_size) if coord_attrib == "x" else "100%",
|
||||||
|
"height": str(min_rect_size) if coord_attrib == "y" else "100%",
|
||||||
|
# "style": "stroke:#0000ff;stroke-width:0.1;stroke-dasharray:1,1;fill:none"
|
||||||
|
"style": "fill:#0000ff;fill-opacity:0.1"
|
||||||
|
})
|
||||||
|
|
||||||
# Find the average spacing between tracks, ignoring gaps that are likely to be more than one cell.
|
# Find the average spacing between tracks, ignoring gaps that are likely to be more than one cell.
|
||||||
# I'm calling this gap because I'm lazy.
|
# I'm calling this gap because I'm lazy.
|
||||||
max_gap = min_rect_size * 2
|
max_gap = min_rect_size * 2
|
||||||
|
Loading…
Reference in New Issue
Block a user