mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 20:06:02 +02:00
Maintain offset of bottom with nearest display edge if Interface resized
This commit is contained in:
parent
8445c9fbc7
commit
ec74cb4aec
1 changed files with 31 additions and 16 deletions
|
@ -371,7 +371,7 @@ var usersWindow = (function () {
|
||||||
isMinimized = false,
|
isMinimized = false,
|
||||||
isBorderVisible = false,
|
isBorderVisible = false,
|
||||||
|
|
||||||
viewportHeight,
|
viewport,
|
||||||
isMirrorDisplay = false,
|
isMirrorDisplay = false,
|
||||||
isFullscreenMirror = false,
|
isFullscreenMirror = false,
|
||||||
|
|
||||||
|
@ -858,22 +858,37 @@ var usersWindow = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onScriptUpdate() {
|
function onScriptUpdate() {
|
||||||
var oldViewportHeight = viewportHeight,
|
var oldViewport = viewport,
|
||||||
oldIsMirrorDisplay = isMirrorDisplay,
|
oldIsMirrorDisplay = isMirrorDisplay,
|
||||||
oldIsFullscreenMirror = isFullscreenMirror,
|
oldIsFullscreenMirror = isFullscreenMirror,
|
||||||
MIRROR_MENU_ITEM = "Mirror",
|
MIRROR_MENU_ITEM = "Mirror",
|
||||||
FULLSCREEN_MIRROR_MENU_ITEM = "Fullscreen Mirror";
|
FULLSCREEN_MIRROR_MENU_ITEM = "Fullscreen Mirror";
|
||||||
|
|
||||||
viewportHeight = Controller.getViewportDimensions().y;
|
viewport = Controller.getViewportDimensions();
|
||||||
isMirrorDisplay = Menu.isOptionChecked(MIRROR_MENU_ITEM);
|
isMirrorDisplay = Menu.isOptionChecked(MIRROR_MENU_ITEM);
|
||||||
isFullscreenMirror = Menu.isOptionChecked(FULLSCREEN_MIRROR_MENU_ITEM);
|
isFullscreenMirror = Menu.isOptionChecked(FULLSCREEN_MIRROR_MENU_ITEM);
|
||||||
|
|
||||||
if (viewportHeight !== oldViewportHeight || isMirrorDisplay !== oldIsMirrorDisplay
|
if (viewport.y !== oldViewport.y || isMirrorDisplay !== oldIsMirrorDisplay
|
||||||
|| isFullscreenMirror !== oldIsFullscreenMirror) {
|
|| isFullscreenMirror !== oldIsFullscreenMirror) {
|
||||||
calculateWindowHeight();
|
calculateWindowHeight();
|
||||||
updateUsersDisplay();
|
updateUsersDisplay();
|
||||||
updateOverlayPositions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (viewport.y !== oldViewport.y) {
|
||||||
|
if (windowPosition.y > oldViewport.y / 2) {
|
||||||
|
// Maintain position w.r.t. bottom of window.
|
||||||
|
windowPosition.y = viewport.y - (oldViewport.y - windowPosition.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (viewport.x !== oldViewport.x) {
|
||||||
|
if (windowPosition.x + (WINDOW_WIDTH / 2) > oldViewport.x / 2) {
|
||||||
|
// Maintain position w.r.t. right of window.
|
||||||
|
windowPosition.x = viewport.x - (oldViewport.x - windowPosition.x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateOverlayPositions();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setUp() {
|
function setUp() {
|
||||||
|
@ -888,14 +903,14 @@ var usersWindow = (function () {
|
||||||
windowLineHeight = windowTextHeight + windowLineSpacing;
|
windowLineHeight = windowTextHeight + windowLineSpacing;
|
||||||
Overlays.deleteOverlay(textSizeOverlay);
|
Overlays.deleteOverlay(textSizeOverlay);
|
||||||
|
|
||||||
viewportHeight = Controller.getViewportDimensions().y;
|
viewport = Controller.getViewportDimensions();
|
||||||
windowPosition = { x: 0, y: viewportHeight };
|
windowPosition = { x: 0, y: viewport.y };
|
||||||
|
|
||||||
calculateWindowHeight();
|
calculateWindowHeight();
|
||||||
|
|
||||||
windowBorder = Overlays.addOverlay("rectangle", {
|
windowBorder = Overlays.addOverlay("rectangle", {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: viewportHeight, // Start up off-screen
|
y: viewport.y, // Start up off-screen
|
||||||
width: WINDOW_BORDER_WIDTH,
|
width: WINDOW_BORDER_WIDTH,
|
||||||
height: windowBorderHeight,
|
height: windowBorderHeight,
|
||||||
radius: WINDOW_BORDER_RADIUS,
|
radius: WINDOW_BORDER_RADIUS,
|
||||||
|
@ -906,7 +921,7 @@ var usersWindow = (function () {
|
||||||
|
|
||||||
windowPane = Overlays.addOverlay("text", {
|
windowPane = Overlays.addOverlay("text", {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: viewportHeight,
|
y: viewport.y,
|
||||||
width: WINDOW_WIDTH,
|
width: WINDOW_WIDTH,
|
||||||
height: windowHeight,
|
height: windowHeight,
|
||||||
topMargin: WINDOW_MARGIN + windowLineHeight,
|
topMargin: WINDOW_MARGIN + windowLineHeight,
|
||||||
|
@ -922,7 +937,7 @@ var usersWindow = (function () {
|
||||||
|
|
||||||
windowHeading = Overlays.addOverlay("text", {
|
windowHeading = Overlays.addOverlay("text", {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: viewportHeight,
|
y: viewport.y,
|
||||||
width: WINDOW_WIDTH - 2 * WINDOW_MARGIN,
|
width: WINDOW_WIDTH - 2 * WINDOW_MARGIN,
|
||||||
height: windowTextHeight,
|
height: windowTextHeight,
|
||||||
topMargin: 0,
|
topMargin: 0,
|
||||||
|
@ -937,7 +952,7 @@ var usersWindow = (function () {
|
||||||
|
|
||||||
minimizeButton = Overlays.addOverlay("image", {
|
minimizeButton = Overlays.addOverlay("image", {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: viewportHeight,
|
y: viewport.y,
|
||||||
width: MIN_MAX_BUTTON_WIDTH,
|
width: MIN_MAX_BUTTON_WIDTH,
|
||||||
height: MIN_MAX_BUTTON_HEIGHT,
|
height: MIN_MAX_BUTTON_HEIGHT,
|
||||||
imageURL: MIN_MAX_BUTTON_SVG,
|
imageURL: MIN_MAX_BUTTON_SVG,
|
||||||
|
@ -954,7 +969,7 @@ var usersWindow = (function () {
|
||||||
|
|
||||||
scrollbarBackgroundPosition = {
|
scrollbarBackgroundPosition = {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: viewportHeight
|
y: viewport.y
|
||||||
};
|
};
|
||||||
scrollbarBackground = Overlays.addOverlay("text", {
|
scrollbarBackground = Overlays.addOverlay("text", {
|
||||||
x: 0,
|
x: 0,
|
||||||
|
@ -969,7 +984,7 @@ var usersWindow = (function () {
|
||||||
|
|
||||||
scrollbarBarPosition = {
|
scrollbarBarPosition = {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: viewportHeight
|
y: viewport.y
|
||||||
};
|
};
|
||||||
scrollbarBar = Overlays.addOverlay("text", {
|
scrollbarBar = Overlays.addOverlay("text", {
|
||||||
x: 0,
|
x: 0,
|
||||||
|
@ -984,7 +999,7 @@ var usersWindow = (function () {
|
||||||
|
|
||||||
friendsButton = Overlays.addOverlay("image", {
|
friendsButton = Overlays.addOverlay("image", {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: viewportHeight,
|
y: viewport.y,
|
||||||
width: FRIENDS_BUTTON_WIDTH,
|
width: FRIENDS_BUTTON_WIDTH,
|
||||||
height: FRIENDS_BUTTON_HEIGHT,
|
height: FRIENDS_BUTTON_HEIGHT,
|
||||||
imageURL: FRIENDS_BUTTON_SVG,
|
imageURL: FRIENDS_BUTTON_SVG,
|
||||||
|
@ -1004,7 +1019,7 @@ var usersWindow = (function () {
|
||||||
values: DISPLAY_VALUES,
|
values: DISPLAY_VALUES,
|
||||||
displayValues: DISPLAY_DISPLAY_VALUES,
|
displayValues: DISPLAY_DISPLAY_VALUES,
|
||||||
x: 0,
|
x: 0,
|
||||||
y: viewportHeight,
|
y: viewport.y,
|
||||||
width: WINDOW_WIDTH - 1.5 * WINDOW_MARGIN,
|
width: WINDOW_WIDTH - 1.5 * WINDOW_MARGIN,
|
||||||
promptWidth: DISPLAY_PROMPT_WIDTH,
|
promptWidth: DISPLAY_PROMPT_WIDTH,
|
||||||
lineHeight: windowLineHeight,
|
lineHeight: windowLineHeight,
|
||||||
|
@ -1037,7 +1052,7 @@ var usersWindow = (function () {
|
||||||
values: VISIBILITY_VALUES,
|
values: VISIBILITY_VALUES,
|
||||||
displayValues: VISIBILITY_DISPLAY_VALUES,
|
displayValues: VISIBILITY_DISPLAY_VALUES,
|
||||||
x: 0,
|
x: 0,
|
||||||
y: viewportHeight,
|
y: viewport.y,
|
||||||
width: WINDOW_WIDTH - 1.5 * WINDOW_MARGIN,
|
width: WINDOW_WIDTH - 1.5 * WINDOW_MARGIN,
|
||||||
promptWidth: VISIBILITY_PROMPT_WIDTH,
|
promptWidth: VISIBILITY_PROMPT_WIDTH,
|
||||||
lineHeight: windowLineHeight,
|
lineHeight: windowLineHeight,
|
||||||
|
|
Loading…
Reference in a new issue