Make code mouse more reliable with scroll position
This commit is contained in:
parent
1211891f53
commit
194209f18f
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user