mirror of
https://github.com/Krafpy/KSP-MGA-Planner.git
synced 2025-12-05 20:40:13 -08:00
Clamp textbox header position in window.
This commit is contained in:
4
dist/main/editor/draggable-text.js
vendored
4
dist/main/editor/draggable-text.js
vendored
@@ -37,8 +37,8 @@ export class DraggableTextbox {
|
||||
};
|
||||
const clamp = (x, a, b) => x < a ? a : x > b ? b : x;
|
||||
document.onmouseup = () => {
|
||||
left = clamp(left, 0, window.innerWidth - div.offsetWidth);
|
||||
top = clamp(top, 0, window.innerHeight - div.offsetHeight);
|
||||
left = clamp(left, 0, window.innerWidth - header.offsetWidth);
|
||||
top = clamp(top, 0, window.innerHeight - header.offsetHeight);
|
||||
setPos();
|
||||
document.onmouseup = null;
|
||||
document.onmousemove = null;
|
||||
|
||||
@@ -50,8 +50,8 @@ export class DraggableTextbox {
|
||||
const clamp = (x:number, a:number, b:number) => x < a ? a : x > b ? b : x;
|
||||
|
||||
document.onmouseup = () => {
|
||||
left = clamp(left, 0, window.innerWidth - div.offsetWidth);
|
||||
top = clamp(top, 0, window.innerHeight - div.offsetHeight);
|
||||
left = clamp(left, 0, window.innerWidth - header.offsetWidth);
|
||||
top = clamp(top, 0, window.innerHeight - header.offsetHeight);
|
||||
setPos();
|
||||
|
||||
document.onmouseup = null;
|
||||
|
||||
Reference in New Issue
Block a user