Intgrading the docs

This commit is contained in:
Luis Fernando Molina committed 2020-09-03 14:30:26 +02:00
1 parent 3f66d48e7a
commit 6f474fd959
13 files changed
+546 -162

No files matched your search

+145 -27
View File
@@ -554,9 +554,9 @@
},
"menuItems": [
{
"action": "Edit Formula",
"action": "Edit",
"actionFunction": "uiObject.formulaEditor.activate",
"label": "Edit Formula",
"label": "Edit",
"iconPathOn": "html",
"iconPathOff": "html"
},
@@ -589,9 +589,9 @@
},
"menuItems": [
{
"action": "Edit Code",
"action": "Edit",
"actionFunction": "uiObject.codeEditor.activate",
"label": "Edit Code",
"label": "Edit",
"iconPathOn": "html",
"iconPathOff": "html"
},
@@ -649,7 +649,6 @@
"icon": "chart-point",
"level": 4,
"propertyNameAtParent": "points",
"isReferenceParent": true,
"chainAttachesTo": {
"compatibleTypes": "->Chart Points->"
},
@@ -699,9 +698,9 @@
},
"menuItems": [
{
"action": "Edit Formula",
"action": "Edit",
"actionFunction": "uiObject.formulaEditor.activate",
"label": "Edit Formula",
"label": "Edit",
"iconPathOn": "html",
"iconPathOff": "html"
},
@@ -798,9 +797,9 @@
"properties": [],
"menuItems": [
{
"action": "Edit Condition",
"action": "Edit",
"actionFunction": "uiObject.codeEditor.activate",
"label": "Edit Condition",
"label": "Edit",
"iconPathOn": "html",
"iconPathOff": "html"
},
@@ -987,9 +986,9 @@
"properties": [],
"menuItems": [
{
"action": "Edit Condition",
"action": "Edit",
"actionFunction": "uiObject.codeEditor.activate",
"label": "Edit Condition",
"label": "Edit",
"iconPathOn": "html",
"iconPathOff": "html"
},
@@ -1062,9 +1061,9 @@
},
"menuItems": [
{
"action": "Edit Formula",
"action": "Edit",
"actionFunction": "uiObject.formulaEditor.activate",
"label": "Edit Formula",
"label": "Edit",
"iconPathOn": "html",
"iconPathOff": "html"
},
@@ -1175,9 +1174,9 @@
"properties": [],
"menuItems": [
{
"action": "Edit Condition",
"action": "Edit",
"actionFunction": "uiObject.codeEditor.activate",
"label": "Edit Condition",
"label": "Edit",
"iconPathOn": "html",
"iconPathOff": "html"
},
@@ -1316,9 +1315,9 @@
],
"menuItems": [
{
"action": "Edit Condition",
"action": "Edit",
"actionFunction": "uiObject.codeEditor.activate",
"label": "Edit Condition",
"label": "Edit",
"iconPathOn": "html",
"iconPathOff": "html"
},
@@ -1417,6 +1416,13 @@
"actionFunction": "payload.onMenuItemClick",
"ring": 1
},
{
"action": "Share Workspace",
"iconPathOn": "menu-share",
"iconPathOff": "menu-share",
"actionFunction": "payload.onMenuItemClick",
"ring": 1
},
{
"action": "Backup Workspace",
"iconPathOn": "menu-backup",
@@ -1462,10 +1468,9 @@
"actionFunction": "payload.onMenuItemClick"
},
{
"action": "Share Workspace",
"label": "Share",
"iconPathOn": "menu-share",
"iconPathOff": "menu-share",
"action": "Add UI Object",
"label": "Add Tutorial",
"relatedUiObject": "Tutorial",
"actionFunction": "payload.onMenuItemClick"
}
],
@@ -1532,9 +1537,9 @@
"docURL": "https://docs.superalgos.org/suite-hierarchy-trading-system.html#condition",
"menuItems": [
{
"action": "Edit Condition",
"action": "Edit",
"actionFunction": "uiObject.conditionEditor.activate",
"label": "Edit Condition",
"label": "Edit",
"relatedUiObject": "Condition"
},
{
@@ -9700,8 +9705,8 @@
"docURL": "https://docs.superalgos.org/suite-hierarchy-trading-system.html#formula",
"menuItems": [
{
"action": "Edit Formula",
"label": "Edit Formula",
"action": "Edit",
"label": "Edit",
"iconPathOn": "html",
"iconPathOff": "html",
"dontShowAtFullscreen": true,
@@ -9735,8 +9740,8 @@
"type": "Announcement Formula",
"menuItems": [
{
"action": "Edit Formula",
"label": "Edit Formula",
"action": "Edit",
"label": "Edit",
"iconPathOn": "html",
"iconPathOff": "html",
"dontShowAtFullscreen": true,
@@ -14088,5 +14093,118 @@
"autoAdd": false
}
]
},
{
"type": "Tutorial",
"menuItems": [
{
"action": "Play Tutorial",
"label": "Play",
"relatedUiObject": "Tutorial",
"actionFunction": "payload.onMenuItemClick"
},
{
"action": "Resume Tutorial",
"label": "Resume",
"relatedUiObject": "Tutorial",
"actionFunction": "payload.onMenuItemClick"
},
{
"action": "Configure",
"actionFunction": "uiObject.configEditor.activate",
"label": "Configure",
"iconPathOn": "html",
"iconPathOff": "html"
},
{
"action": "Add UI Object",
"label": "Add Tutorial Step",
"relatedUiObject": "Tutorial Step",
"actionFunction": "payload.onMenuItemClick"
},
{
"action": "Delete UI Object",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete",
"iconPathOff": "delete",
"actionFunction": "payload.onMenuItemClick"
}
],
"editors": {
"config": true
},
"initialValues": {
"config": "{ \n}"
},
"isTitleAllwaysVisible": true,
"isHierarchyHead": true,
"addLeftIcons": true,
"level": 0,
"icon": "approve",
"propertyNameAtParent": "tutorials",
"properties": [
{
"name": "tutorialSteps",
"type": "array",
"childType": "Tutorial Step",
"autoAdd": false
}
]
},
{
"type": "Tutorial Step",
"menuItems": [
{
"action": "Play Tutorial Step",
"label": "Play",
"relatedUiObject": "Tutorial",
"actionFunction": "payload.onMenuItemClick"
},
{
"action": "Configure",
"actionFunction": "uiObject.configEditor.activate",
"label": "Configure",
"iconPathOn": "html",
"iconPathOff": "html"
},
{
"action": "Add UI Object",
"label": "Add Tutorial Step",
"relatedUiObject": "Tutorial Step",
"actionFunction": "payload.onMenuItemClick"
},
{
"action": "Delete UI Object",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete",
"iconPathOff": "delete",
"actionFunction": "payload.onMenuItemClick"
}
],
"editors": {
"config": true
},
"initialValues": {
"config": "{ \n\"paragraphs\": \n[\n\"\",\n\"\",\n\"\" \n], \n\"done\": false\n}"
},
"referenceAttachesTo": {
"compatibleTypes": "->*Any Node*->"
},
"addLeftIcons": true,
"level": 1,
"icon": "cardano",
"propertyNameAtParent": "tutorials",
"properties": [
{
"name": "tutorialSteps",
"type": "array",
"childType": "Tutorial Step",
"autoAdd": false
}
]
}
]
+2 -5
View File
@@ -88,6 +88,7 @@ function newAppLoader() {
'Spaces/FloatingSpace.js',
'Spaces/DesignSpace.js',
'Spaces/SideSpace.js',
'Spaces/DocSpace.js',
'Files/SingleFile.js',
'Files/FileCloud.js',
@@ -154,13 +155,9 @@ function newAppLoader() {
modulesArray = modulesArray.concat(plotters)
let downloadedCounter = 0
let versionParam = window.canvasApp.version
if (versionParam === undefined) { versionParam = '' } else {
versionParam = '?' + versionParam
}
for (let i = 0; i < modulesArray.length; i++) {
let path = window.canvasApp.urlPrefix + modulesArray[i] + versionParam
let path = modulesArray[i]
REQUIREJS([path], onRequired)
+57 -83
View File
@@ -39,109 +39,83 @@ function loadSuperalgos() {
const MODULE_NAME = "App Pre-Loader";
const INFO_LOG = false;
const ERROR_LOG = true;
if (INFO_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[INFO] loadSuperalgos -> Entering function."); }
setupHTMLTextArea()
setupHTMLInput()
setupHTMLCanvas()
loadDebugModule()
/* The first thing to do here is to add the canvas where all the action is going to happen. */
function setupHTMLTextArea() {
let textArea = document.createElement('textarea');
textArea.id = "textArea";
textArea.spellcheck = false;
textArea.style = 'resize: none;' +
' border: none;' +
' outline: none;' +
'box-shadow: none;' +
'overflow:hidden;' +
'font-family: ' + 'Saira' + ';' +
'font-size: 12px;' +
'background-color: rgb(255, 255, 255);' +
'color:rgb(255, 255, 255);' +
'width: ' + 600 + 'px;' +
'height: ' + 400 + 'px'
let textAreaDiv = document.getElementById('textAreaDiv');
textAreaDiv.appendChild(textArea);
textAreaDiv.style = 'position:fixed; top:' + -1500 + 'px; left:' + 500 + 'px; z-index:10; '
}
let textArea = document.createElement('textarea');
textArea.id = "textArea";
textArea.spellcheck = false;
textArea.style = 'resize: none;' +
' border: none;' +
' outline: none;' +
'box-shadow: none;' +
'overflow:hidden;' +
'font-family: ' + 'Saira' + ';' +
'font-size: 12px;' +
'background-color: rgb(255, 255, 255);' +
'color:rgb(255, 255, 255);' +
'width: ' + 600 + 'px;' +
'height: ' + 400 + 'px'
function setupHTMLInput() {
let input = document.createElement('input');
input.id = "input";
input.spellcheck = false;
input.style = "border: none; outline: none; box-shadow: none; overflow:hidden; width: 0px; height: 0px;";
let textAreaDiv = document.getElementById('textAreaDiv');
textAreaDiv.appendChild(textArea);
textAreaDiv.style = 'position:fixed; top:' + -1500 + 'px; left:' + 500 + 'px; z-index:10; '
let inputDiv = document.getElementById('inputDiv');
inputDiv.appendChild(input);
}
let input = document.createElement('input');
input.id = "input";
input.spellcheck = false;
input.style = "border: none; outline: none; box-shadow: none; overflow:hidden; width: 0px; height: 0px;";
function setupHTMLCanvas() {
let canvas = document.createElement('canvas');
let inputDiv = document.getElementById('inputDiv');
inputDiv.appendChild(input);
canvas.id = "canvas";
canvas.width = 1400;
canvas.height = 600;
canvas.style.border = "0";
canvas.style = "position:absolute; top:0px; left:0px; z-index:1";
let canvasApp = document.getElementById('canvasApp');
canvasApp.appendChild(canvas);
let canvas = document.createElement('canvas');
browserCanvas = document.getElementById('canvas');
canvas.id = "canvas";
canvas.width = 1400;
canvas.height = 600;
canvas.style.border = "0";
canvas.style = "position:absolute; top:0px; left:0px; z-index:1";
browserCanvas.width = window.innerWidth;
browserCanvas.height = window.innerHeight;
browserCanvas.style.border = "none";
let canvasApp = document.getElementById('canvasApp');
canvasApp.appendChild(canvas);
browserCanvas = document.getElementById('canvas');
browserCanvas.width = window.innerWidth;
browserCanvas.height = window.innerHeight - window.canvasApp.topMargin;
browserCanvas.style.border = "none";
browserCanvas.style.top = window.canvasApp.topMargin + 'px';
loadDebugModule();
browserCanvas.style.top = 0 + 'px';
}
function loadDebugModule() {
let path = "WebDebugLog.js";
REQUIREJS([path], onRequired);
try {
if (INFO_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[INFO] loadDebugModule -> Entering function."); }
let path = window.canvasApp.urlPrefix + "WebDebugLog.js";
REQUIREJS([path], onRequired);
function onRequired(pModule) {
if (INFO_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[INFO] " + path + " downloaded."); }
loadModules();
}
}
catch (err) {
console.log(spacePad(MODULE_NAME, 50) + " : " + "[ERROR] loadDebugModule --> " + path + " --> err = " + err.stack);
function onRequired(pModule) {
if (INFO_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[INFO] " + path + " downloaded."); }
loadModules();
}
}
/* And Finally, we start loading all the scripts we will inmediatelly need. */
function loadModules() {
let path = "WebServer/AppLoader.js";
REQUIREJS([path], onRequired);
try {
if (INFO_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[INFO] loadModules -> Entering function."); }
let path = window.canvasApp.urlPrefix + "WebServer/AppLoader.js";
REQUIREJS([path], onRequired);
function onRequired(pModule) {
if (INFO_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[INFO] " + path + " downloaded."); }
let APP_LOADER_MODULE = newAppLoader();
APP_LOADER_MODULE.loadModules();
}
}
catch (err) {
console.log(spacePad(MODULE_NAME, 50) + " : " + "[ERROR] loadModules --> " + path + " --> err = " + err.stack);
function onRequired(pModule) {
if (INFO_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[INFO] " + path + " downloaded."); }
let APP_LOADER_MODULE = newAppLoader();
APP_LOADER_MODULE.loadModules();
}
}
}
+3 -5
View File
@@ -12,10 +12,6 @@
<script type="text/javascript">
function loadCanvas() {
window.canvasApp = {
urlPrefix: ''
};
try {
loadSuperalgos();
} catch (err) {
@@ -40,8 +36,10 @@
onresize="onResize()">
<div id="masterApp"></div>
<div id="canvasApp"></div>
<div id="docApp" style="position:fixed; top:100000px; left:100000px">
<iframe id="docIFrame" src="https://docs.superalgos.org/" style="border:none; " height="2000" width="900"></iframe>
</div>
<div id="textAreaDiv"></div>
<div id="inputDiv" style="font-family:saira condensed;">&nbsp;</div>
</body>
</html>
+48 -1
View File
@@ -32,6 +32,7 @@ function newCanvas() {
eventHandler: undefined,
topSpace: undefined,
sideSpace: undefined,
docSpace: undefined,
chartingSpace: undefined,
floatingSpace: undefined,
panelsSpace: undefined,
@@ -61,6 +62,7 @@ function newCanvas() {
function finalize() {
try {
thisObject.docSpace.finalize()
thisObject.sideSpace.finalize()
thisObject.chartingSpace.finalize()
thisObject.floatingSpace.finalize()
@@ -122,6 +124,9 @@ function newCanvas() {
thisObject.sideSpace = newSideSpace()
thisObject.sideSpace.initialize()
thisObject.docSpace = newDocSpace()
thisObject.docSpace.initialize()
thisObject.splashScreen = newSplashScreen()
let animation = newAnimation()
@@ -136,6 +141,7 @@ function newCanvas() {
animation.addCallBackFunction('Design Space Physics', thisObject.designSpace.physics)
animation.addCallBackFunction('Panels Space Physics', thisObject.panelsSpace.physics)
animation.addCallBackFunction('Side Space Physics', thisObject.sideSpace.physics)
animation.addCallBackFunction('Doc Space Physics', thisObject.docSpace.physics)
/* Spcaces Drawing */
animation.addCallBackFunction('Floating Space Draw', thisObject.floatingSpace.draw)
@@ -145,6 +151,7 @@ function newCanvas() {
animation.addCallBackFunction('Design Space Draw', thisObject.designSpace.draw)
animation.addCallBackFunction('Top Space Draw', thisObject.topSpace.draw)
animation.addCallBackFunction('Side Space Draw', thisObject.sideSpace.draw)
animation.addCallBackFunction('Doc Space Draw', thisObject.docSpace.draw)
animation.addCallBackFunction('Splash Screen Draw', thisObject.splashScreen.draw)
animation.start()
} catch (err) {
@@ -565,6 +572,20 @@ function newCanvas() {
let container
/* We check if the mouse is over an element of the Doc Space / */
container = thisObject.docSpace.getContainer(point)
if (container !== undefined && container.isDraggeable === true) {
containerBeingDragged = container
containerDragStarted = true
containerBeingDragged.eventHandler.raiseEvent('onDragStarted', point)
return
}
if (container !== undefined && container.isDraggeable === false) {
return
}
/* We check if the mouse is over an element of the Side Space / */
container = thisObject.sideSpace.getContainer(point)
@@ -694,6 +715,14 @@ function newCanvas() {
let container
/* We check if the mouse is over an element of the Doc Space / */
container = thisObject.docSpace.getContainer(point, GET_CONTAINER_PURPOSE.MOUSE_CLICK)
if (container !== undefined && container.isClickeable === true) {
container.eventHandler.raiseEvent('onMouseClick', point)
return
}
/* We check if the mouse is over an element of the Side Space / */
container = thisObject.sideSpace.getContainer(point, GET_CONTAINER_PURPOSE.MOUSE_CLICK)
@@ -836,7 +865,17 @@ function newCanvas() {
let container
/* We check if the mouse is over an element of the Designe Space / */
/* We check if the mouse is over an element of the Doc Space / */
if (thisObject.docSpace !== undefined) {
container = thisObject.docSpace.getContainer(point, GET_CONTAINER_PURPOSE.MOUSE_OVER)
if (container !== undefined && container.detectMouseOver === true) {
containerFound()
return
}
}
/* We check if the mouse is over an element of the Side Space / */
if (thisObject.sideSpace !== undefined) {
container = thisObject.sideSpace.getContainer(point, GET_CONTAINER_PURPOSE.MOUSE_OVER)
@@ -944,6 +983,14 @@ function newCanvas() {
event.mousePosition = point
let container
/* Doc Space */
container = canvas.docSpace.getContainer({ x: point.x, y: point.y })
if (container !== undefined && container.isWheelable === true) {
container.eventHandler.raiseEvent('onMouseWheel', event)
return false // This instructs the browser not to take the event and scroll the page.
}
/* Side Space */
container = canvas.sideSpace.getContainer({ x: point.x, y: point.y })
+1 -2
View File
@@ -685,8 +685,7 @@ function newWorkspace() {
let definition = getNodeDefinition(payload.node)
if (definition !== undefined) {
if (definition.docURL !== undefined) {
let newTab = window.open(definition.docURL, '_blank')
newTab.focus()
canvas.docSpace.navigateTo(definition.docURL)
}
}
}
+2 -2
View File
@@ -617,7 +617,7 @@ function newUiObject() {
let distance = nearby[0]
let floatingObject = nearby[1]
let nearbyNode = floatingObject.payload.node
if (compatibleTypes.indexOf('->' + nearbyNode.type + '->') >= 0) {
if (compatibleTypes.indexOf('->' + nearbyNode.type + '->') >= 0 || compatibleTypes === "->*Any Node*->" ) {
if (foundCompatible === false) {
if (distance < thisObject.payload.floatingObject.container.frame.radius * 1.5 + floatingObject.container.frame.radius * 1.5) {
nearbyNode.payload.uiObject.getReadyToReferenceAttach()
@@ -1925,7 +1925,7 @@ function newUiObject() {
/* Hierarchy Head Ring */
if (nodeDefinition.isHierarchyHead === true) {
VISIBLE_RADIUS = thisObject.payload.floatingObject.currentHierarchyRing * 3.8
VISIBLE_RADIUS = thisObject.payload.floatingObject.currentHierarchyRing * 2.6
if (canvas.floatingSpace.inMapMode === true) {
VISIBLE_RADIUS = canvas.floatingSpace.transformRadiusToMap(VISIBLE_RADIUS)
}
+105 -18
View File
@@ -1,8 +1,11 @@
function newSidePanelTab() {
const MODULE_NAME = 'Side Panel Tab'
let thisObject = {
pointerDirection: 'left',
screenside: undefined,
pointerDirection: undefined,
container: undefined,
open: open,
close: close,
resize: resize,
physics: physics,
draw: draw,
@@ -12,6 +15,7 @@ function newSidePanelTab() {
const TAB_WIDTH = 25
const TAB_HEIGHT = 60
const ANIMATION_STEP = 100
let isInitialized = false
let animation = 'none'
@@ -26,7 +30,18 @@ function newSidePanelTab() {
return thisObject
function initialize() {
function initialize(screenside) {
thisObject.screenside = screenside
switch (thisObject.screenside) {
case 'left': {
thisObject.pointerDirection = 'left'
break
}
case 'right': {
thisObject.pointerDirection = 'right'
break
}
}
thisObject.container.frame.width = TAB_WIDTH
thisObject.container.frame.height = TAB_HEIGHT
@@ -38,18 +53,51 @@ function newSidePanelTab() {
}
function resize() {
thisObject.container.frame.position.x = 0 + thisObject.container.parentContainer.frame.width
switch (thisObject.screenside) {
case 'left': {
thisObject.container.frame.position.x = 0 + thisObject.container.parentContainer.frame.width
break
}
case 'right': {
thisObject.container.frame.position.x = 0 - TAB_WIDTH
break
}
}
thisObject.container.frame.position.y = 69
setClosed()
}
function open() {
animation = 'opening'
}
function close() {
animation = 'closing'
}
function onMouseClick(event) {
if (thisObject.pointerDirection === 'left') {
animation = 'opening'
thisObject.container.eventHandler.raiseEvent('opening')
} else {
animation = 'closing'
thisObject.container.eventHandler.raiseEvent('closing')
switch (thisObject.screenside) {
case 'left': {
if (thisObject.pointerDirection === 'left') {
animation = 'opening'
thisObject.container.eventHandler.raiseEvent('opening')
} else {
animation = 'closing'
thisObject.container.eventHandler.raiseEvent('closing')
}
break
}
case 'right': {
if (thisObject.pointerDirection === 'left') {
animation = 'closing'
thisObject.container.eventHandler.raiseEvent('closing')
} else {
animation = 'opening'
thisObject.container.eventHandler.raiseEvent('opening')
}
break
}
}
}
@@ -74,11 +122,20 @@ function newSidePanelTab() {
}
function animate() {
const STEP = 50
if (animation === 'opening') {
xOffset = xOffset + STEP
thisObject.container.parentContainer.frame.position.x = ORIGINAL_PARENT_POSITON + xOffset
xOffset = xOffset + ANIMATION_STEP
switch (thisObject.screenside) {
case 'left': {
thisObject.container.parentContainer.frame.position.x = ORIGINAL_PARENT_POSITON + xOffset
break
}
case 'right': {
thisObject.container.parentContainer.frame.position.x = ORIGINAL_PARENT_POSITON - xOffset
break
}
}
if (xOffset >= thisObject.container.parentContainer.frame.width) {
setOpened()
thisObject.container.eventHandler.raiseEvent('opened')
@@ -86,8 +143,18 @@ function newSidePanelTab() {
}
if (animation === 'closing') {
xOffset = xOffset - STEP
thisObject.container.parentContainer.frame.position.x = ORIGINAL_PARENT_POSITON + xOffset
xOffset = xOffset - ANIMATION_STEP
switch (thisObject.screenside) {
case 'left': {
thisObject.container.parentContainer.frame.position.x = ORIGINAL_PARENT_POSITON + xOffset
break
}
case 'right': {
thisObject.container.parentContainer.frame.position.x = ORIGINAL_PARENT_POSITON - xOffset
break
}
}
if (xOffset <= 0) {
setClosed()
thisObject.container.eventHandler.raiseEvent('closed')
@@ -98,16 +165,36 @@ function newSidePanelTab() {
function setOpened() {
animation = 'none'
xOffset = thisObject.container.parentContainer.frame.width
thisObject.container.parentContainer.frame.position.x = ORIGINAL_PARENT_POSITON + xOffset
thisObject.container.parentContainer.status = 'visible'
thisObject.pointerDirection = 'right'
switch (thisObject.screenside) {
case 'left': {
thisObject.container.parentContainer.frame.position.x = ORIGINAL_PARENT_POSITON + xOffset
thisObject.pointerDirection = 'right'
break
}
case 'right': {
thisObject.container.parentContainer.frame.position.x = ORIGINAL_PARENT_POSITON - xOffset
thisObject.pointerDirection = 'left'
break
}
}
}
function setClosed() {
animation = 'none'
xOffset = 0
thisObject.container.parentContainer.frame.position.x = ORIGINAL_PARENT_POSITON
thisObject.container.parentContainer.status = 'hidden'
thisObject.pointerDirection = 'left'
switch (thisObject.screenside) {
case 'left': {
thisObject.container.parentContainer.frame.position.x = ORIGINAL_PARENT_POSITON
thisObject.pointerDirection = 'left'
break
}
case 'right': {
thisObject.container.parentContainer.frame.position.x = ORIGINAL_PARENT_POSITON
thisObject.pointerDirection = 'right'
break
}
}
}
function arrow() {
+2 -16
View File
@@ -2,7 +2,6 @@
function newDesignSpace() {
const MODULE_NAME = 'Designe Space'
let thisObject = {
sidePanel: undefined,
container: undefined,
iconCollection: undefined,
iconByUiObjectType: undefined,
@@ -313,7 +312,7 @@ function newDesignSpace() {
function onImageLoad() {
image.canDrawIcon = true
}
image.src = window.canvasApp.urlPrefix + PATH + name + '.png'
image.src = PATH + name + '.png'
thisObject.iconCollection.set(name, image)
}
}
@@ -331,24 +330,11 @@ function newDesignSpace() {
}
function getContainer(point) {
let container
if (thisObject.sidePanel !== undefined) {
container = thisObject.sidePanel.getContainer(point)
if (container !== undefined) {
container.space = 'Design Space'
return container
}
}
return
}
function draw() {
if (canWeDraw === false) { return }
if (thisObject.sidePanel !== undefined) {
thisObject.sidePanel.draw()
}
if (thisObject.workspace !== undefined) {
thisObject.workspace.draw()
}
+178
View File
@@ -0,0 +1,178 @@
function newDocSpace() {
const MODULE_NAME = 'Doc Space'
let thisObject = {
sidePanelTab: undefined,
container: undefined,
navigateTo: navigateTo,
physics: physics,
draw: draw,
getContainer: getContainer,
initialize: initialize,
finalize: finalize
}
let isInitialized = false
thisObject.container = newContainer()
thisObject.container.name = MODULE_NAME
thisObject.container.initialize()
thisObject.container.isClickeable = true
thisObject.container.isDraggeable = false
thisObject.container.detectMouseOver = true
thisObject.container.status = 'hidden'
resize()
let openingEventSubscriptionId
let closedEventSubscriptionId
let browserResizedEventSubscriptionId
return thisObject
function initialize() {
thisObject.sidePanelTab = newSidePanelTab()
thisObject.sidePanelTab.container.connectToParent(thisObject.container, false, false)
thisObject.sidePanelTab.initialize('right')
browserResizedEventSubscriptionId = canvas.eventHandler.listenToEvent('Browser Resized', resize)
isInitialized = true
}
function finalize() {
canvas.eventHandler.stopListening(browserResizedEventSubscriptionId)
thisObject.sidePanelTab.container.eventHandler.stopListening(openingEventSubscriptionId)
thisObject.sidePanelTab.container.eventHandler.stopListening(closedEventSubscriptionId)
}
function navigateTo(url) {
let docIFrame = document.getElementById('docIFrame')
docIFrame.src = url
thisObject.sidePanelTab.open()
}
function resize() {
thisObject.container.frame.width = 900
thisObject.container.frame.height = browserCanvas.height // - TOP_SPACE_HEIGHT
thisObject.container.frame.position.x = browserCanvas.width
thisObject.container.frame.position.y = 0 // TOP_SPACE_HEIGHT
if (thisObject.sidePanelTab !== undefined) {
thisObject.sidePanelTab.resize()
}
}
function getContainer(point, purpose) {
let container
container = thisObject.sidePanelTab.getContainer(point, purpose)
if (container !== undefined) { return container }
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return thisObject.container
} else {
return undefined
}
}
function physics() {
thisObject.sidePanelTab.physics()
docAppDivPhysics()
iFramePhysics()
function docAppDivPhysics() {
let docAppDiv = document.getElementById('docApp')
docAppDivPosition = {
x: 0,
y: 0
}
docAppDivPosition = thisObject.container.frame.frameThisPoint(docAppDivPosition)
docAppDiv.style = ' overflow-x: hidden; ' +
'position:fixed; top:' + docAppDivPosition.y + 'px; ' +
'left:' + docAppDivPosition.x + 'px; z-index:1; ' +
'width: ' + thisObject.container.frame.width + 'px;' +
'height: ' + thisObject.container.frame.height + 'px'
}
function iFramePhysics() {
let docIFrame = document.getElementById('docIFrame')
docIFrame.style = 'overflow-x: hidden; ' +
'width: ' + thisObject.container.frame.width + 'px;' +
'height: ' + thisObject.container.frame.height + 'px'
}
}
function draw() {
if (canWeDraw === false) { return }
if (isInitialized === false) { return }
borders()
thisObject.sidePanelTab.draw()
}
function borders() {
let point1
let point2
let point3
let point4
point1 = {
x: 0,
y: 0
}
point2 = {
x: thisObject.container.frame.width,
y: 0
}
point3 = {
x: thisObject.container.frame.width,
y: thisObject.container.frame.height
}
point4 = {
x: 0,
y: thisObject.container.frame.height
}
point1 = thisObject.container.frame.frameThisPoint(point1)
point2 = thisObject.container.frame.frameThisPoint(point2)
point3 = thisObject.container.frame.frameThisPoint(point3)
point4 = thisObject.container.frame.frameThisPoint(point4)
browserCanvasContext.setLineDash([0, 0])
browserCanvasContext.beginPath()
browserCanvasContext.moveTo(point1.x, point1.y)
browserCanvasContext.lineTo(point2.x, point2.y)
browserCanvasContext.lineTo(point3.x, point3.y)
browserCanvasContext.lineTo(point4.x, point4.y)
browserCanvasContext.lineTo(point1.x, point1.y)
browserCanvasContext.closePath()
let opacity = 1
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.LIGHT_GREY + ', ' + opacity + ''
browserCanvasContext.fill()
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.GREY + ', ' + opacity + ''
browserCanvasContext.lineWidth = 0.3
browserCanvasContext.stroke()
/* Shadow */
if (thisObject.container.status !== 'hidden') {
for (let i = 0; i <= 30; i++) {
opacity = 1 - (i / 300) - 0.95
browserCanvasContext.setLineDash([0, 0])
browserCanvasContext.beginPath()
browserCanvasContext.moveTo(point2.x + i, point2.y)
browserCanvasContext.lineTo(point3.x + i, point3.y)
browserCanvasContext.closePath()
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.BLACK + ', ' + opacity + ''
browserCanvasContext.lineWidth = 1
browserCanvasContext.stroke()
}
}
}
}
+1 -1
View File
@@ -32,7 +32,7 @@ function newSideSpace() {
function initialize() {
thisObject.sidePanelTab = newSidePanelTab()
thisObject.sidePanelTab.container.connectToParent(thisObject.container, false, false)
thisObject.sidePanelTab.initialize()
thisObject.sidePanelTab.initialize('left')
browserResizedEventSubscriptionId = canvas.eventHandler.listenToEvent('Browser Resized', resize)
+1 -1
View File
@@ -35,7 +35,7 @@ function newTopSpace() {
function onImageLoad() {
image.canDraw = true
}
image.src = window.canvasApp.urlPrefix + PATH + name + '.png'
image.src = PATH + name + '.png'
}
}
+1 -1
View File
@@ -43,7 +43,7 @@ function newSplashScreen() {
function onImageLoad() {
canDrawLogo = true
}
logo.src = window.canvasApp.urlPrefix + 'Images/superalgos-logo.png'
logo.src = 'Images/superalgos-logo.png'
canvas.eventHandler.listenToEvent('Browser Resized', resize)
isInitialized = true