diff options
author | Devaev Maxim <[email protected]> | 2021-05-24 08:58:14 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2021-05-24 08:58:14 +0300 |
commit | db192b0769f3b9e8f6940eb463a2294130bced94 (patch) | |
tree | 2bd1cb5fdc109e376e8863253c2c8ed01faa688b /web/share/js/kvm/mouse.js | |
parent | 580d7c118260b349eb0c6347a4c0247791eb92a3 (diff) |
refactoring
Diffstat (limited to 'web/share/js/kvm/mouse.js')
-rw-r--r-- | web/share/js/kvm/mouse.js | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/web/share/js/kvm/mouse.js b/web/share/js/kvm/mouse.js index 3199745b..6babafa6 100644 --- a/web/share/js/kvm/mouse.js +++ b/web/share/js/kvm/mouse.js @@ -27,14 +27,11 @@ import {tools, $} from "../tools.js"; import {Keypad} from "../keypad.js"; -export function Mouse(get_resolution_callback, record_callback) { +export function Mouse(__getResolution, __recordWsEvent) { var self = this; /************************************************************************/ - var __get_resolution_callback = get_resolution_callback; - var __record_callback = record_callback; - var __ws = null; var __online = true; var __absolute = true; @@ -237,7 +234,7 @@ export function Mouse(get_resolution_callback, record_callback) { // - Видим нарушение пропорций // Так что теперь используются быстре рассчеты через offset* // вместо getBoundingClientRect(). - let res = __get_resolution_callback(); + let res = __getResolution(); let ratio = Math.min(res.view_width / res.real_width, res.view_height / res.real_height); return { "x": Math.round((res.view_width - ratio * res.real_width) / 2), @@ -304,7 +301,7 @@ export function Mouse(get_resolution_callback, record_callback) { if (__ws && !$("hid-mute-switch").checked) { __ws.send(JSON.stringify(event)); } - __record_callback(event); + __recordWsEvent(event); }; __init__(); |