Rework of #39 (#40)

* Rework of #39 patch from @arykov (thanks)

* styled resize corner

* fixed squashing of resizaable window on moving

* keep window size and opsition after full screen

* not necessary

* attempt to fix desktop overflow

* improved

* ios fixes

* refactoring
This commit is contained in:
Maxim Devaev
2021-04-12 15:26:32 +03:00
committed by GitHub
parent 8158941833
commit 3af4a8b852
15 changed files with 1478 additions and 1332 deletions

View File

@@ -40,8 +40,8 @@ export function Mouse(record_callback) {
var __keypad = null;
var __current_pos = {x: 0, y:0};
var __sent_pos = {x: 0, y:0};
var __current_pos = {x: 0, y: 0};
var __sent_pos = {x: 0, y: 0};
var __wheel_delta = {x: 0, y: 0};
var __relative_deltas = [];
@@ -210,15 +210,16 @@ export function Mouse(record_callback) {
if (__absolute) {
let pos = __current_pos;
if (pos.x !== __sent_pos.x || pos.y !== __sent_pos.y) {
let el_stream_image = $("stream-image");
let to = {
x: __translate(pos.x, 0, el_stream_image.clientWidth, -32768, 32767),
y: __translate(pos.y, 0, el_stream_image.clientHeight, -32768, 32767),
};
tools.debug("Mouse: moved:", to);
__sendEvent("mouse_move", {"to": to});
__sent_pos = pos;
let geometry = $("stream-box").stream_geometry;
if (geometry) {
let to = {
x: __translate(pos.x, geometry.x, geometry.width, -32768, 32767),
y: __translate(pos.y, geometry.y, geometry.height, -32768, 32767),
};
tools.debug("Mouse: moved:", to);
__sendEvent("mouse_move", {"to": to});
__sent_pos = pos;
}
}
} else if (__relative_deltas.length) {
tools.debug("Mouse: relative:", __relative_deltas);
@@ -228,7 +229,13 @@ export function Mouse(record_callback) {
};
var __translate = function(x, a, b, c, d) {
return Math.round((x - a) / (b - a) * (d - c) + c);
let translated = Math.round((x - a) / b * (d - c) + c);
if (translated < c) {
return c;
} else if (translated > d) {
return d;
}
return translated;
};
var __streamWheelHandler = function(event) {