diff --git a/static/js/editors.js b/static/js/editors.js index 5265de6..7b1dbbe 100644 --- a/static/js/editors.js +++ b/static/js/editors.js @@ -282,7 +282,7 @@ var editors = { }); editor.on('focus', function (cm) { - windows.clearSideBottom(); + windows.clearFloat(); }); editor.setSize('100%', $(".edit-panel").height() - $(".edit-panel .tabs").height()); diff --git a/static/js/hotkeys.js b/static/js/hotkeys.js index 2a86ed5..c552ebf 100644 --- a/static/js/hotkeys.js +++ b/static/js/hotkeys.js @@ -192,12 +192,16 @@ var hotkeys = { if (event.ctrlKey === hotKeys.goFileTree.ctrlKey && event.which === hotKeys.goFileTree.which) { // Ctrl+1 焦点切换到文件树 // 有些元素需设置 tabindex 为 -1 时才可以 focus - if (windows.isEditorMax()) { - // 编辑器全屏 - $(".bottom-window-group").css("top", "100%"); + if ($(".footer .ico-restore:eq(0)").css("display") === "inline") { + // 当文件树最小化时 $(".side").css({ "left": "0" }); + + if ($(".footer .ico-restore:eq(1)").css("display") === "inline") { + // 当底部最小化时 + $(".bottom-window-group").css("top", "100%"); + } } $("#files").focus(); diff --git a/static/js/windows.js b/static/js/windows.js index 0585309..89c279e 100644 --- a/static/js/windows.js +++ b/static/js/windows.js @@ -54,10 +54,12 @@ var windows = { $(window).click(function (event) { if ($(event.target).closest(".footer").length === 1 - || $(event.target).closest(".bottom-window-group").length === 1) { + || $(event.target).closest(".bottom-window-group").length === 1 + || $(event.target).closest(".side").length === 1) { return false; } - windows.clearSideBottom(); + + windows.clearFloat(); }); }, maxBottom: function () { @@ -65,11 +67,11 @@ var windows = { if ($it.hasClass("bottom-window-group-max")) { windows.restoreBottom(); - if ($(".side").css("left") !== "0px") { - $it.css({ - "left": "0px", - "width": "100%" - }); + if ($(".side").css("left") !== "0px" && $(".side").css("left") !== "auto") { + $it.css({ + "left": "0px", + "width": "100%" + }); } } else { $it.attr("style", ""); @@ -90,13 +92,14 @@ var windows = { } }, restoreBottom: function () { - $(".bottom-window-group").removeClass("bottom-window-group-max"); - var bottomH = $(".bottom-window-group").height(); + var $it = $(".bottom-window-group"); + $it.removeClass("bottom-window-group-max").attr("style", ""); + var bottomH = $it.height(); $(".bottom-window-group .output, notification").height(bottomH - 24); $(".bottom-window-group .notification, .bottom-window-group .search").height(bottomH - 20); - $(".bottom-window-group").animate({ + $it.animate({ "top": "70%" }, function () { $(".edit-panel").css("height", "70%"); @@ -163,26 +166,31 @@ var windows = { windows.restoreSide(); wide.curEditor.focus(); }, - clearSideBottom: function () { - if (!this.isEditorMax()) { - return false; - } - $(".side").css("left", "-20%"); - $(".bottom-window-group").css("top", "100%"); - }, - flowBottom: function () { - if (this.isEditorMax()) { - $(".bottom-window-group").animate({"top": "70%"}); - $(".side").css("left", "-20%"); - } - }, - isEditorMax: function () { - if ($(".toolbars .ico-restore").length === 1 - && $(".footer .ico-restore:eq(0)").css("display") === "inline" - && $(".footer .ico-restore:eq(1)").css("display") === "inline") { - return true; + clearFloat: function () { + if ($(".footer .ico-restore:eq(0)").css("display") === "inline") { + // 当文件树最小化时 + windows.minSide(); } - return false; + if ($(".footer .ico-restore:eq(1)").css("display") === "inline") { + // 当底部最小化时 + windows.minBottom(); + } + }, + flowBottom: function () { + if ($(".footer .ico-restore:eq(1)").css("display") === "inline") { + // 当底部树最小化时 + $(".bottom-window-group").css({ + "top": "70%", + "left": "0px", + "width": "100%", + "z-index": "8" + }); + + if ($(".footer .ico-restore:eq(0)").css("display") === "inline") { + // 当文件最小化时 + $(".side").css("left", "-20%"); + } + } } }; \ No newline at end of file