mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 00:08:53 +02:00
Fix up syntax per JSLint
This commit is contained in:
parent
e92b4029b2
commit
991f7fe873
1 changed files with 27 additions and 18 deletions
|
@ -21,8 +21,7 @@ var PopUpMenu = function(properties) {
|
||||||
MIN_MAX_BUTTON_SVG_WIDTH = 17.1,
|
MIN_MAX_BUTTON_SVG_WIDTH = 17.1,
|
||||||
MIN_MAX_BUTTON_SVG_HEIGHT = 32.5,
|
MIN_MAX_BUTTON_SVG_HEIGHT = 32.5,
|
||||||
MIN_MAX_BUTTON_WIDTH = 14,
|
MIN_MAX_BUTTON_WIDTH = 14,
|
||||||
MIN_MAX_BUTTON_HEIGHT = MIN_MAX_BUTTON_WIDTH;
|
MIN_MAX_BUTTON_HEIGHT = MIN_MAX_BUTTON_WIDTH,
|
||||||
|
|
||||||
MIN_MAX_BUTTON_SVG = Script.resolvePath("assets/images/tools/min-max-toggle.svg");
|
MIN_MAX_BUTTON_SVG = Script.resolvePath("assets/images/tools/min-max-toggle.svg");
|
||||||
|
|
||||||
function positionDisplayOptions() {
|
function positionDisplayOptions() {
|
||||||
|
@ -220,9 +219,8 @@ var PopUpMenu = function(properties) {
|
||||||
|
|
||||||
var usersWindow = (function () {
|
var usersWindow = (function () {
|
||||||
|
|
||||||
var baseURL = Script.resolvePath("assets/images/tools/");
|
var baseURL = Script.resolvePath("assets/images/tools/"),
|
||||||
|
WINDOW_WIDTH = 260,
|
||||||
var WINDOW_WIDTH = 260,
|
|
||||||
WINDOW_MARGIN = 12,
|
WINDOW_MARGIN = 12,
|
||||||
WINDOW_BASE_MARGIN = 6, // A little less is needed in order look correct
|
WINDOW_BASE_MARGIN = 6, // A little less is needed in order look correct
|
||||||
WINDOW_FONT = {
|
WINDOW_FONT = {
|
||||||
|
@ -383,7 +381,9 @@ var usersWindow = (function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reserve space for title, friends button, and option controls
|
// Reserve space for title, friends button, and option controls
|
||||||
nonUsersHeight = WINDOW_MARGIN + windowLineHeight + FRIENDS_BUTTON_SPACER + FRIENDS_BUTTON_HEIGHT + DISPLAY_SPACER + windowLineHeight + VISIBILITY_SPACER + windowLineHeight + WINDOW_BASE_MARGIN;
|
nonUsersHeight = WINDOW_MARGIN + windowLineHeight + FRIENDS_BUTTON_SPACER + FRIENDS_BUTTON_HEIGHT + DISPLAY_SPACER
|
||||||
|
+ windowLineHeight + VISIBILITY_SPACER
|
||||||
|
+ windowLineHeight + WINDOW_BASE_MARGIN;
|
||||||
|
|
||||||
// Limit window to height of viewport minus VU meter and mirror if displayed
|
// Limit window to height of viewport minus VU meter and mirror if displayed
|
||||||
windowHeight = linesOfUsers.length * windowLineHeight - windowLineSpacing + nonUsersHeight;
|
windowHeight = linesOfUsers.length * windowLineHeight - windowLineSpacing + nonUsersHeight;
|
||||||
|
@ -422,12 +422,15 @@ var usersWindow = (function() {
|
||||||
Overlays.editOverlay(scrollbarBackground, {
|
Overlays.editOverlay(scrollbarBackground, {
|
||||||
y: scrollbarBackgroundPosition.y
|
y: scrollbarBackgroundPosition.y
|
||||||
});
|
});
|
||||||
scrollbarBarPosition.y = scrollbarBackgroundPosition.y + 1 + scrollbarValue * (scrollbarBackgroundHeight - scrollbarBarHeight - 2);
|
scrollbarBarPosition.y = scrollbarBackgroundPosition.y + 1
|
||||||
|
+ scrollbarValue * (scrollbarBackgroundHeight - scrollbarBarHeight - 2);
|
||||||
Overlays.editOverlay(scrollbarBar, {
|
Overlays.editOverlay(scrollbarBar, {
|
||||||
y: scrollbarBarPosition.y
|
y: scrollbarBarPosition.y
|
||||||
});
|
});
|
||||||
|
|
||||||
y = viewportHeight - FRIENDS_BUTTON_HEIGHT - DISPLAY_SPACER - windowLineHeight - VISIBILITY_SPACER - windowLineHeight - WINDOW_BASE_MARGIN;
|
y = viewportHeight - FRIENDS_BUTTON_HEIGHT - DISPLAY_SPACER
|
||||||
|
- windowLineHeight - VISIBILITY_SPACER
|
||||||
|
- windowLineHeight - WINDOW_BASE_MARGIN;
|
||||||
Overlays.editOverlay(friendsButton, {
|
Overlays.editOverlay(friendsButton, {
|
||||||
y: y
|
y: y
|
||||||
});
|
});
|
||||||
|
@ -683,7 +686,8 @@ var usersWindow = (function() {
|
||||||
|
|
||||||
userClicked = firstUserToDisplay + lineClicked;
|
userClicked = firstUserToDisplay + lineClicked;
|
||||||
|
|
||||||
if (0 <= userClicked && userClicked < linesOfUsers.length && 0 <= overlayX && overlayX <= usersOnline[linesOfUsers[userClicked]].textWidth) {
|
if (0 <= userClicked && userClicked < linesOfUsers.length && 0 <= overlayX
|
||||||
|
&& overlayX <= usersOnline[linesOfUsers[userClicked]].textWidth) {
|
||||||
//print("Go to " + usersOnline[linesOfUsers[userClicked]].username);
|
//print("Go to " + usersOnline[linesOfUsers[userClicked]].username);
|
||||||
location.goToUser(usersOnline[linesOfUsers[userClicked]].username);
|
location.goToUser(usersOnline[linesOfUsers[userClicked]].username);
|
||||||
}
|
}
|
||||||
|
@ -740,8 +744,12 @@ var usersWindow = (function() {
|
||||||
|
|
||||||
function onMouseMoveEvent(event) {
|
function onMouseMoveEvent(event) {
|
||||||
if (isMovingScrollbar) {
|
if (isMovingScrollbar) {
|
||||||
if (scrollbarBackgroundPosition.x - WINDOW_MARGIN <= event.x && event.x <= scrollbarBackgroundPosition.x + SCROLLBAR_BACKGROUND_WIDTH + WINDOW_MARGIN && scrollbarBackgroundPosition.y - WINDOW_MARGIN <= event.y && event.y <= scrollbarBackgroundPosition.y + scrollbarBackgroundHeight + WINDOW_MARGIN) {
|
if (scrollbarBackgroundPosition.x - WINDOW_MARGIN <= event.x
|
||||||
scrollbarValue = (event.y - scrollbarBarClickedAt * scrollbarBarHeight - scrollbarBackgroundPosition.y) / (scrollbarBackgroundHeight - scrollbarBarHeight - 2);
|
&& event.x <= scrollbarBackgroundPosition.x + SCROLLBAR_BACKGROUND_WIDTH + WINDOW_MARGIN
|
||||||
|
&& scrollbarBackgroundPosition.y - WINDOW_MARGIN <= event.y
|
||||||
|
&& event.y <= scrollbarBackgroundPosition.y + scrollbarBackgroundHeight + WINDOW_MARGIN) {
|
||||||
|
scrollbarValue = (event.y - scrollbarBarClickedAt * scrollbarBarHeight - scrollbarBackgroundPosition.y)
|
||||||
|
/ (scrollbarBackgroundHeight - scrollbarBarHeight - 2);
|
||||||
scrollbarValue = Math.min(Math.max(scrollbarValue, 0.0), 1.0);
|
scrollbarValue = Math.min(Math.max(scrollbarValue, 0.0), 1.0);
|
||||||
firstUserToDisplay = Math.floor(scrollbarValue * (linesOfUsers.length - numUsersToDisplay));
|
firstUserToDisplay = Math.floor(scrollbarValue * (linesOfUsers.length - numUsersToDisplay));
|
||||||
updateOverlayPositions();
|
updateOverlayPositions();
|
||||||
|
@ -773,7 +781,8 @@ var usersWindow = (function() {
|
||||||
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 || isFullscreenMirror !== oldIsFullscreenMirror) {
|
if (viewportHeight !== oldViewportHeight || isMirrorDisplay !== oldIsMirrorDisplay
|
||||||
|
|| isFullscreenMirror !== oldIsFullscreenMirror) {
|
||||||
calculateWindowHeight();
|
calculateWindowHeight();
|
||||||
updateUsersDisplay();
|
updateUsersDisplay();
|
||||||
updateOverlayPositions();
|
updateOverlayPositions();
|
||||||
|
|
Loading…
Reference in a new issue