Skip to content

Commit 3dbcc42

Browse files
committed
fix(timeline): wrong mouse coorginates on HiDPI screen
1 parent d480fe4 commit 3dbcc42

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/app-frontend/src/features/timeline/TimelineView.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default defineComponent({
6363
}
6464
6565
function getTimePosition (time: number) {
66-
return (time - nonReactiveTime.minTime.value) / (nonReactiveTime.endTime.value - nonReactiveTime.startTime.value) * app.view.width
66+
return (time - nonReactiveTime.minTime.value) / (nonReactiveTime.endTime.value - nonReactiveTime.startTime.value) * app.view.width / window.devicePixelRatio
6767
}
6868
6969
// Reset
@@ -1087,7 +1087,7 @@ export default defineComponent({
10871087
// Firefox doesn't block the event https://bugzilla.mozilla.org/show_bug.cgi?id=1632465
10881088
event.preventDefault()
10891089
1090-
const centerRatio = event.offsetX / viewWidth
1090+
const centerRatio = event.offsetX / viewWidth / window.devicePixelRatio
10911091
const center = size * centerRatio + startTime.value
10921092
10931093
let newSize = size + event.deltaY / viewWidth * size * 2
@@ -1174,8 +1174,8 @@ export default defineComponent({
11741174
}
11751175
11761176
if (cameraDragging) {
1177-
const deltaX = startDragX - x
1178-
const deltaY = startDragY - y
1177+
const deltaX = (startDragX - x) / window.devicePixelRatio
1178+
const deltaY = (startDragY - y) / window.devicePixelRatio
11791179
11801180
// Horizontal
11811181
const size = endTime.value - startTime.value

0 commit comments

Comments
 (0)