Autoformatter applied on all js files
This commit is contained in:
1 parent
72c1017b20
commit
c627aedcf6
59 files changed
+9087
-10892
No files matched your search
+80
-93
@@ -1,114 +1,104 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
The Panel Space y the place wehre all panels live, no matter who create them.
|
||||
The Panel Space y the place wehre all panels live, no matter who create them.
|
||||
|
||||
*/
|
||||
|
||||
function newPanelsSpace() {
|
||||
function newPanelsSpace () {
|
||||
var thisObject = {
|
||||
container: undefined,
|
||||
createNewPanel: createNewPanel,
|
||||
destroyPanel: destroyPanel,
|
||||
getPanel: getPanel,
|
||||
draw: draw,
|
||||
panels: [],
|
||||
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
|
||||
initialize: initialize
|
||||
}
|
||||
|
||||
var thisObject = {
|
||||
container: undefined,
|
||||
createNewPanel: createNewPanel,
|
||||
destroyPanel: destroyPanel,
|
||||
getPanel: getPanel,
|
||||
draw: draw,
|
||||
panels: [],
|
||||
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
|
||||
initialize: initialize
|
||||
};
|
||||
var container = newContainer()
|
||||
container.initialize()
|
||||
thisObject.container = container
|
||||
thisObject.container.isDraggeable = false
|
||||
|
||||
var container = newContainer();
|
||||
container.initialize();
|
||||
thisObject.container = container;
|
||||
thisObject.container.isDraggeable = false;
|
||||
container.displacement.containerName = 'Panels Space'
|
||||
container.frame.containerName = 'Panels Space'
|
||||
|
||||
container.displacement.containerName = "Panels Space";
|
||||
container.frame.containerName = "Panels Space";
|
||||
return thisObject
|
||||
|
||||
return thisObject;
|
||||
|
||||
function initialize() {
|
||||
function initialize () {
|
||||
|
||||
/* The space does not create any Panels for itself, it just sits and waits others need panels. */
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function createNewPanel(pType, pParameters) {
|
||||
function createNewPanel (pType, pParameters) {
|
||||
let panel
|
||||
|
||||
let panel;
|
||||
switch (pType) {
|
||||
|
||||
switch (pType) {
|
||||
|
||||
case "Time Control Panel":
|
||||
{
|
||||
panel = newTimeControlPanel();
|
||||
panel.initialize();
|
||||
break;
|
||||
}
|
||||
|
||||
case "Products Panel":
|
||||
{
|
||||
panel = newProductsPanel();
|
||||
panel.initialize();
|
||||
break;
|
||||
}
|
||||
case "Plotter Panel":
|
||||
{
|
||||
panel = getNewPlotterPanel(pParameters.devTeam, pParameters.plotterCodeName, pParameters.moduleCodeName, pParameters.panelCodeName);
|
||||
panel.initialize();
|
||||
break;
|
||||
}
|
||||
case 'Time Control Panel':
|
||||
{
|
||||
panel = newTimeControlPanel()
|
||||
panel.initialize()
|
||||
break
|
||||
}
|
||||
|
||||
thisObject.panels.push(panel);
|
||||
|
||||
panel.handle = Math.floor((Math.random() * 10000000) + 1);
|
||||
|
||||
return panel.handle;
|
||||
}
|
||||
|
||||
function destroyPanel(pPanelHandle) {
|
||||
|
||||
for (let i = 0; i < thisObject.panels.length; i++) {
|
||||
|
||||
let panel = thisObject.panels[i];
|
||||
|
||||
if (panel.handle === pPanelHandle) {
|
||||
thisObject.panels.splice(i, 1); // Delete item from array.
|
||||
return;
|
||||
}
|
||||
case 'Products Panel':
|
||||
{
|
||||
panel = newProductsPanel()
|
||||
panel.initialize()
|
||||
break
|
||||
}
|
||||
case 'Plotter Panel':
|
||||
{
|
||||
panel = getNewPlotterPanel(pParameters.devTeam, pParameters.plotterCodeName, pParameters.moduleCodeName, pParameters.panelCodeName)
|
||||
panel.initialize()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
function getPanel(pPanelHandle) {
|
||||
thisObject.panels.push(panel)
|
||||
|
||||
for (let i = 0; i < thisObject.panels.length; i++) {
|
||||
panel.handle = Math.floor((Math.random() * 10000000) + 1)
|
||||
|
||||
let panel = thisObject.panels[i];
|
||||
return panel.handle
|
||||
}
|
||||
|
||||
if (panel.handle === pPanelHandle) {
|
||||
return panel;
|
||||
}
|
||||
}
|
||||
function destroyPanel (pPanelHandle) {
|
||||
for (let i = 0; i < thisObject.panels.length; i++) {
|
||||
let panel = thisObject.panels[i]
|
||||
|
||||
if (panel.handle === pPanelHandle) {
|
||||
thisObject.panels.splice(i, 1) // Delete item from array.
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function draw() {
|
||||
function getPanel (pPanelHandle) {
|
||||
for (let i = 0; i < thisObject.panels.length; i++) {
|
||||
let panel = thisObject.panels[i]
|
||||
|
||||
thisObject.container.frame.draw(false, false);
|
||||
if (panel.handle === pPanelHandle) {
|
||||
return panel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function draw () {
|
||||
thisObject.container.frame.draw(false, false)
|
||||
|
||||
/* When we draw a time machine, that means also to draw all the charts in it. */
|
||||
|
||||
for (var i = 0; i < thisObject.panels.length; i++) {
|
||||
|
||||
let panel = thisObject.panels[i];
|
||||
panel.draw();
|
||||
|
||||
}
|
||||
for (var i = 0; i < thisObject.panels.length; i++) {
|
||||
let panel = thisObject.panels[i]
|
||||
panel.draw()
|
||||
}
|
||||
}
|
||||
|
||||
function getContainer(point) {
|
||||
|
||||
let container;
|
||||
function getContainer (point) {
|
||||
let container
|
||||
|
||||
/*
|
||||
|
||||
@@ -117,21 +107,18 @@ function newPanelsSpace() {
|
||||
|
||||
*/
|
||||
|
||||
for (var i = thisObject.panels.length - 1; i >= 0; i--) {
|
||||
|
||||
container = thisObject.panels[i].getContainer(point);
|
||||
|
||||
if (container !== undefined) {
|
||||
for (var i = thisObject.panels.length - 1; i >= 0; i--) {
|
||||
container = thisObject.panels[i].getContainer(point)
|
||||
|
||||
if (container !== undefined) {
|
||||
/* We found an inner container which has the point. We return it. */
|
||||
|
||||
return container;
|
||||
}
|
||||
}
|
||||
return container
|
||||
}
|
||||
}
|
||||
|
||||
/* The point does not belong to any inner container, so we return the current container. */
|
||||
|
||||
return thisObject.container;
|
||||
|
||||
}
|
||||
}
|
||||
return thisObject.container
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user