|
@@ -20,6 +20,7 @@
|
|
|
background-image: url('img/desktop/bg/init.jpg');
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
+ overflow: hidden;
|
|
|
}
|
|
|
|
|
|
.backgroundFrame {
|
|
@@ -1702,11 +1703,16 @@
|
|
|
//Generate the stackedWindowList
|
|
|
var windowIdList = JSON.parse(decodeURIComponent($(this).attr("windowidgroup")));
|
|
|
if (windowIdList.length == 1) {
|
|
|
- //There are only one window in this group. Show it anyway
|
|
|
+ //There are only one window in this group. Focus that floatWindow
|
|
|
var targetFW = getFloatWindowByID(windowIdList[0]);
|
|
|
$(targetFW).fadeIn(100);
|
|
|
MoveFloatWindowToTop(targetFW);
|
|
|
stackedFloatWindowListShown = false;
|
|
|
+
|
|
|
+ if (checkIfFloatWindowOutsideWindowArea(targetFW)){
|
|
|
+ //This floatWindow is outside of the display area.
|
|
|
+ resetFloatWindowPosition(targetFW);
|
|
|
+ }
|
|
|
$("#stackedWindowList").hide();
|
|
|
} else {
|
|
|
//Get icon for each windows and build the list objects
|
|
@@ -1787,6 +1793,51 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //Check if the given floatWindow DOM object is located outside the screen area.
|
|
|
+ function checkIfFloatWindowOutsideWindowArea(targetFW, checkForCompletelyOutside=true){
|
|
|
+ let fwTop = $(targetFW).offset().top;
|
|
|
+ let fwLeft = $(targetFW).offset().left;
|
|
|
+ let fwBottom = $(targetFW).offset().left + $(targetFW).width();
|
|
|
+ let fwRight = $(targetFW).offset().top + $(targetFW).height();
|
|
|
+
|
|
|
+ //Check for floatWindow complete
|
|
|
+ if (checkForCompletelyOutside){
|
|
|
+ if (fwBottom < 0 || fwTop > window.innerHeight + 1){
|
|
|
+ return true;
|
|
|
+ }else if (fwRight < 0 || fwLeft > window.innerWidth + 1){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }else{
|
|
|
+ //Check if any edge of the fw is outside of the document window
|
|
|
+ if (fwTop < 0 || fwBottom > window.innerHeight + 1){
|
|
|
+ return true;
|
|
|
+ }else if (fwLeft < 0 || fwRight > window.innerWidth + 1){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //Reset the given floatWindow object position on screen
|
|
|
+ function resetFloatWindowPosition(targetFW, center=true){
|
|
|
+ if (center == true){
|
|
|
+ //Calculate the corner position of the target
|
|
|
+ var newTop = window.innerHeight/2 - $(targetFW).height()/2;
|
|
|
+ var newLeft = window.innerWidth/2 - $(targetFW).width()/2;
|
|
|
+ $(targetFW).css({
|
|
|
+ left: newLeft,
|
|
|
+ top: newTop,
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ //Reset to origin + 10
|
|
|
+ $(targetFW).css({
|
|
|
+ left: 10,
|
|
|
+ top: 10,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//Handle floatWindow resize events
|
|
|
let resizingWindowTarget;
|