Skip to content

Commit

Permalink
Thumbnail: do not truncate thumbnail border position or shape
Browse files Browse the repository at this point in the history
For high-dpi displays, this would cause small borders to look very bad
because they could be misaligned from the actual thumbnail by more
than one display pixel.
  • Loading branch information
torque committed Feb 8, 2025
1 parent 021b1fc commit 33b5278
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Thumbnail.moon
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,12 @@ class Thumbnail extends BarAccent
hoverTime = mp.get_property_number( 'duration', 0 ) * Mouse.x / Window.w

scaledWidth = @thumbfast.width / Window.osdScale

thumbX = clamp(@lastX, leftMargin + (scaledWidth / 2), Window.w - rightMargin - (scaledWidth / 2))
@line[2] = [[%d,%d]]\format thumbX, Window.h - (bottomMargin - borderExpansion)
thumbX = clamp @lastX, leftMargin + (scaledWidth / 2), Window.w - rightMargin - (scaledWidth / 2)
@line[2] = [[%g,%g]]\format thumbX, Window.h - (bottomMargin - borderExpansion)

width = scaledWidth + (2 * borderExpansion)
height = (@thumbfast.height / Window.osdScale) + (2 * borderExpansion)
@line[4] = [[m 0 0 l %d 0 %d %d 0 %d]]\format width, width, height, height
@line[4] = [[m 0 0 l %g 0 %g %g 0 %g]]\format width, width, height, height

mp.commandv(
'script-message-to', 'thumbfast', 'thumb',
Expand Down

0 comments on commit 33b5278

Please sign in to comment.