mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-02-01 02:21:53 +08:00
pikvm/pikvm#880: Fixed mouse position at edges
This commit is contained in:
@@ -380,8 +380,8 @@ export function Mouse(__getGeometry, __recordWsEvent) {
|
||||
if (pos !== null && (pos.x !== __sent_pos.x || pos.y !== __sent_pos.y)) {
|
||||
let geo = __getGeometry();
|
||||
let to = {
|
||||
"x": tools.remap(pos.x, geo.x, geo.width, -32768, 32767),
|
||||
"y": tools.remap(pos.y, geo.y, geo.height, -32768, 32767),
|
||||
"x": tools.remap(pos.x - geo.x, 0, geo.width - 1, -32768, 32767),
|
||||
"y": tools.remap(pos.y - geo.y, 0, geo.height - 1, -32768, 32767),
|
||||
};
|
||||
tools.debug("Mouse: moved:", to);
|
||||
__sendEvent("mouse_move", {"to": to});
|
||||
|
||||
@@ -137,10 +137,10 @@ export function Ocr(__getGeometry) {
|
||||
let rel_bottom = Math.max(__start_pos.y, __end_pos.y) - rect.top + offset;
|
||||
let geo = __getGeometry();
|
||||
__sel = {
|
||||
"left": tools.remap(rel_left, geo.x, geo.width, 0, geo.real_width),
|
||||
"right": tools.remap(rel_right, geo.x, geo.width, 0, geo.real_width),
|
||||
"top": tools.remap(rel_top, geo.y, geo.height, 0, geo.real_height),
|
||||
"bottom": tools.remap(rel_bottom, geo.y, geo.height, 0, geo.real_height),
|
||||
"left": tools.remap(rel_left - geo.x, 0, geo.width, 0, geo.real_width),
|
||||
"right": tools.remap(rel_right - geo.x, 0, geo.width, 0, geo.real_width),
|
||||
"top": tools.remap(rel_top - geo.y, 0, geo.height, 0, geo.real_height),
|
||||
"bottom": tools.remap(rel_bottom - geo.y, 0, geo.height, 0, geo.real_height),
|
||||
};
|
||||
} else {
|
||||
__sel = null;
|
||||
|
||||
Reference in New Issue
Block a user