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 | |
parent | 580d7c118260b349eb0c6347a4c0247791eb92a3 (diff) |
refactoring
Diffstat (limited to 'web')
-rw-r--r-- | web/share/js/kvm/hid.js | 6 | ||||
-rw-r--r-- | web/share/js/kvm/keyboard.js | 6 | ||||
-rw-r--r-- | web/share/js/kvm/mouse.js | 9 |
3 files changed, 7 insertions, 14 deletions
diff --git a/web/share/js/kvm/hid.js b/web/share/js/kvm/hid.js index b944e268..8e6d3fd0 100644 --- a/web/share/js/kvm/hid.js +++ b/web/share/js/kvm/hid.js @@ -31,13 +31,11 @@ import {Keyboard} from "./keyboard.js"; import {Mouse} from "./mouse.js"; -export function Hid(get_resolution_callback) { +export function Hid(__getResolution) { var self = this; /************************************************************************/ - var __get_resolution_callback = get_resolution_callback; - var __recorder = null; var __keyboard = null; var __mouse = null; @@ -45,7 +43,7 @@ export function Hid(get_resolution_callback) { var __init__ = function() { __recorder = new Recorder(); __keyboard = new Keyboard(__recorder.recordWsEvent); - __mouse = new Mouse(__get_resolution_callback, __recorder.recordWsEvent); + __mouse = new Mouse(__getResolution, __recorder.recordWsEvent); let hidden_attr = null; let visibility_change_attr = null; diff --git a/web/share/js/kvm/keyboard.js b/web/share/js/kvm/keyboard.js index 1ec6b492..7c632d40 100644 --- a/web/share/js/kvm/keyboard.js +++ b/web/share/js/kvm/keyboard.js @@ -24,13 +24,11 @@ import {tools, $, $$$} from "../tools.js"; import {Keypad} from "../keypad.js"; -export function Keyboard(record_callback) { +export function Keyboard(__recordWsEvent) { var self = this; /************************************************************************/ - var __record_callback = record_callback; - var __ws = null; var __online = true; @@ -152,7 +150,7 @@ export function Keyboard(record_callback) { if (__ws && !$("hid-mute-switch").checked) { __ws.send(JSON.stringify(event)); } - __record_callback(event); + __recordWsEvent(event); }; __init__(); 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__(); |