summaryrefslogtreecommitdiff
path: root/kvmd/tools.py
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2021-03-26 21:32:21 +0300
committerDevaev Maxim <[email protected]>2021-03-26 21:32:21 +0300
commita66221a494e35ab070d13291ce82928797bf95d4 (patch)
tree3dd496eccf1f3281dad1d545e50a111c28ccdfbc /kvmd/tools.py
parent1674cf70b3f925fe055398911761542c14d304e9 (diff)
fixed mouse remap
Diffstat (limited to 'kvmd/tools.py')
-rw-r--r--kvmd/tools.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/kvmd/tools.py b/kvmd/tools.py
index d6077938..6237280b 100644
--- a/kvmd/tools.py
+++ b/kvmd/tools.py
@@ -33,6 +33,11 @@ from typing import TypeVar
# =====
+def remap(value: int, in_min: int, in_max: int, out_min: int, out_max: int) -> int:
+ return (value - in_min) * (out_max - out_min) // (in_max - in_min) + out_min
+
+
+# =====
def efmt(err: Exception) -> str:
return f"{type(err).__name__}: {err}"