Make code mouse more reliable with scroll position
This commit is contained in:
1 parent
1211891f53
commit
194209f18f
1 file changed
+4
-2
+4
-2
@@ -520,10 +520,12 @@ const update = async () => {
|
|||||||
state.doubleClickTimer = 10;
|
state.doubleClickTimer = 10;
|
||||||
}
|
}
|
||||||
const {x, y} = mousePos();
|
const {x, y} = mousePos();
|
||||||
state.setSelection(pixelToIndex(state.code, x, y-8));
|
state.setSelection(pixelToIndex(state.code, x+state.scrollX, y+state.scrollY-8));
|
||||||
|
state.scrollToCursor();
|
||||||
} else if (mouseHeld()) {
|
} else if (mouseHeld()) {
|
||||||
const {x, y} = mousePos();
|
const {x, y} = mousePos();
|
||||||
state.setFocus(pixelToIndex(state.code, x, y-8));
|
state.setFocus(pixelToIndex(state.code, x+state.scrollX, y+state.scrollY-8));
|
||||||
|
state.scrollToCursor();
|
||||||
} else {
|
} else {
|
||||||
state.wordMode = false;
|
state.wordMode = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user