improved layout and fixed bugs introduced new ones
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { BaseElement } from "../../../shared/_base";
|
||||
import { CodeEditorContainer } from "../code-editor-container/code-editor-container";
|
||||
import { WindowControl } from "./window-control";
|
||||
import './window-control-connector.less';
|
||||
|
||||
export class WindowControlConnector extends BaseElement {
|
||||
@@ -25,7 +26,7 @@ export class WindowControlConnector extends BaseElement {
|
||||
|
||||
if (target) {
|
||||
target.classList.add("active");
|
||||
target.style.display = "block";
|
||||
target.style.display = "";
|
||||
}
|
||||
|
||||
this.distributeEvenly();
|
||||
@@ -44,20 +45,40 @@ export class WindowControlConnector extends BaseElement {
|
||||
}
|
||||
|
||||
private distributeEvenly() {
|
||||
var elements = <CodeEditorContainer[]>this.findVisible("code-editor-container");
|
||||
var containers = document.getElementsByClassName("code-editor-containers")[0];
|
||||
|
||||
if (elements.length === 0) {
|
||||
containers.classList.add("force-close");
|
||||
}
|
||||
else {
|
||||
containers.classList.remove("force-close");
|
||||
var size = (100 / elements.length) + "%";
|
||||
for (let i = 0; i < elements.length; i++) {
|
||||
const element = elements[i];
|
||||
var windowControl = <WindowControl>this.parentElement;
|
||||
var distTarget = windowControl.getDistibuteTarget();
|
||||
|
||||
element.style.minHeight = size;
|
||||
element.style.maxHeight = size;
|
||||
if (distTarget) {
|
||||
var visibleTargetChildren = this.visibleChildren(distTarget);
|
||||
console.log(visibleTargetChildren);
|
||||
|
||||
if (visibleTargetChildren.length === 0) {
|
||||
distTarget.classList.add("force-close");
|
||||
}
|
||||
else {
|
||||
distTarget.classList.remove("force-close");
|
||||
var size = (100 / visibleTargetChildren.length) + "%";
|
||||
for (let i = 0; i < visibleTargetChildren.length; i++) {
|
||||
const element = visibleTargetChildren[i];
|
||||
|
||||
element.style.minHeight = size;
|
||||
element.style.maxHeight = size;
|
||||
|
||||
if (i === 0) {
|
||||
element.classList.add("first-visible");
|
||||
}
|
||||
else {
|
||||
element.classList.remove("first-visible");
|
||||
}
|
||||
|
||||
if (i + 1 === visibleTargetChildren.length) {
|
||||
element.classList.add("last-visible");
|
||||
}
|
||||
else {
|
||||
element.classList.remove("last-visible");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user