Skip to content

Commit 6e12929

Browse files
committed
fix(gui): correct labels for local density
Signed-off-by: Anton Kriese <[email protected]>
1 parent 924f3ed commit 6e12929

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

GUI/src/main/kotlin/ui/components/diffScreen/timeline/ThumbnailPreview.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ private fun ThumbnailLabel(
251251
width: Float,
252252
modifier: Modifier = Modifier,
253253
) {
254+
val densityCorrectedWidth = with(LocalDensity.current) { width.toDp() }
255+
254256
// Labels Container
255257
Column(
256258
modifier = modifier.fillMaxSize(),
@@ -268,10 +270,10 @@ private fun ThumbnailLabel(
268270
)
269271

270272
// draw a tick for the text
271-
Canvas(modifier = Modifier.fillMaxSize()) {
273+
Canvas(modifier = Modifier.width(densityCorrectedWidth).fillMaxHeight()) {
272274
drawLine(
273-
start = Offset(width / 2, 0f),
274-
end = Offset(width / 2, size.height),
275+
start = Offset(densityCorrectedWidth.toPx() / 2, 0f),
276+
end = Offset(densityCorrectedWidth.toPx() / 2, size.height),
275277
color = lineColor,
276278
strokeWidth = 3f,
277279
)

0 commit comments

Comments
 (0)