Fix pointer position

pull/2/head
Andreas Gysin 2021-03-07 21:09:51 +01:00
rodzic afc3148c3b
commit 7d756cc90d
1 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -247,8 +247,10 @@ export function run(program, runSettings, userData = {}) {
// Cursor update
const cursor = {
x : pointer.x / metrics.cellWidth,
y : pointer.y / metrics.lineHeight,
// The canvas might be slightly larger than the number
// of cols/rows, min is required!
x : Math.min(context.cols-1, pointer.x / metrics.cellWidth),
y : Math.min(context.rows-1, pointer.y / metrics.lineHeight),
pressed : pointer.pressed,
p : { // state of previous frame
x : pointer.px / metrics.cellWidth,