Skip to content

Prevent gap when having many small records #515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions timetagger/app/front.py
Original file line number Diff line number Diff line change
Expand Up @@ -2129,6 +2129,10 @@ def _determine_record_preferred_pos(self, record, t1, y0, y1, y2, npixels, nsecs
ry1 = y0 + npixels * (record.t1 - t1) / nsecs
ry2 = y0 + npixels * (t2_or_now - t1) / nsecs

# Get margin for making space for record before its visible
npixels_record = max(0, ry2 - ry1)
visible_margin = min(npixels_record, 40)

# Determine preferred position
pref = y = (ry1 + ry2) / 2
visible = "main"
Expand All @@ -2138,15 +2142,15 @@ def _determine_record_preferred_pos(self, record, t1, y0, y1, y2, npixels, nsecs
if ry2 < y1:
# Start claiming space before it is visible
y -= 2 * (y1 - ry2)
if ry2 < y1 - 40:
if ry2 < y1 - visible_margin:
visible = ""
elif y > y2 - 20:
y = y2 - 20
visible = "bottom"
if ry1 > y2:
# Start claiming space before it is visible
y += 2 * (ry1 - y2)
if ry1 > y2 + 40:
if ry1 > y2 + visible_margin:
visible = ""

return {"pref": pref, "y": y, "visible": visible}
Expand Down
Loading