diff --git a/Projects/Education/UI/Spaces/Tutorial-Space/TutorialSpace.js b/Projects/Education/UI/Spaces/Tutorial-Space/TutorialSpace.js index 11d44df78..c98cd96e4 100644 --- a/Projects/Education/UI/Spaces/Tutorial-Space/TutorialSpace.js +++ b/Projects/Education/UI/Spaces/Tutorial-Space/TutorialSpace.js @@ -287,18 +287,28 @@ function newEducationTutorialSpace() { function checkImage() { let tutorialImageDiv = document.getElementById('tutorialImageDiv') - if (tutorialImageDiv !== null && tutorialImageDiv !== undefined) { + if (tutorialImageDiv !== null && tutorialImageDiv !== undefined) { tutorialImageDiv.appendChild(htmlImage) } if (newImageName === undefined) { return } if (currentImageName === newImageName) { return } currentImageName = newImageName - let webParam = 'Icons/' + newImageProject + '/' + newImageName + '.png' - - htmlImage.src = webParam - htmlImage.width = "100" - htmlImage.height = "100" + + // If gathering Icon by Project and Name get it now + let icon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName(newImageProject, newImageName) + if (icon !== undefined) { + htmlImage.src = icon.src + htmlImage.width = "100" + htmlImage.height = "100" + } else if (icon === undefined) { + // Legacy Code to handle icons being fetched by literal path + // Note: This if statment should be removed once all tutoials have been refactored + let webParam = 'Icons/' + newImageProject + '/' + newImageName + '.png' + htmlImage.src = webParam + htmlImage.width = "100" + htmlImage.height = "100" + } } function checkDocumentation() { diff --git a/Projects/Foundations/Icons-SVG-Sources/menu/copy-position.svg b/Projects/Foundations/Icons-SVG-Sources/menu/copy-position.svg new file mode 100644 index 000000000..5c68bcd28 --- /dev/null +++ b/Projects/Foundations/Icons-SVG-Sources/menu/copy-position.svg @@ -0,0 +1,8 @@ + +Created with Fabric.js 1.7.22 + + + + + + \ No newline at end of file diff --git a/Projects/Foundations/Icons-SVG-Sources/menu/snap-position.svg b/Projects/Foundations/Icons-SVG-Sources/menu/snap-position.svg new file mode 100644 index 000000000..a272ad69d --- /dev/null +++ b/Projects/Foundations/Icons-SVG-Sources/menu/snap-position.svg @@ -0,0 +1,10 @@ + +Created with Fabric.js 1.7.22 + + + + + + + + \ No newline at end of file diff --git a/Projects/Foundations/Icons/copy-position.png b/Projects/Foundations/Icons/copy-position.png new file mode 100644 index 000000000..fe9d7f13d Binary files /dev/null and b/Projects/Foundations/Icons/copy-position.png differ diff --git a/Projects/Foundations/Icons/snap-position.png b/Projects/Foundations/Icons/snap-position.png new file mode 100644 index 000000000..267719511 Binary files /dev/null and b/Projects/Foundations/Icons/snap-position.png differ diff --git a/Projects/Foundations/Schemas/Docs-Topics/T/Trading/Trading-Logic/trading-logic-002-syntax-overview.json b/Projects/Foundations/Schemas/Docs-Topics/T/Trading/Trading-Logic/trading-logic-002-syntax-overview.json index 45e9fe125..113a9beaf 100644 --- a/Projects/Foundations/Schemas/Docs-Topics/T/Trading/Trading-Logic/trading-logic-002-syntax-overview.json +++ b/Projects/Foundations/Schemas/Docs-Topics/T/Trading/Trading-Logic/trading-logic-002-syntax-overview.json @@ -160,8 +160,8 @@ }, { "style": "Javascript", - "text": "productPluralVariable[tradingEngine.tradingCurrent.tradingEpisode.candle.index.value-n].propertyName", - "updated": 1624868076284 + "text": "productName[tradingEngine.tradingCurrent.tradingEpisode.candle.index.value-n].propertyName", + "updated": 1625193412334 }, { "style": "Text", @@ -175,8 +175,8 @@ }, { "style": "Javascript", - "text": "chart.at01hs.candles[tradingEngine.tradingCurrent.tradingEpisode.candle.index.value-5].max", - "updated": 1624868093927 + "text": "chart.at01hs.candle[tradingEngine.tradingCurrent.tradingEpisode.candle.index.value-5].max", + "updated": 1625193408514 }, { "style": "Text", diff --git a/Projects/Foundations/UI/Function-Libraries/ActionSwitch.js b/Projects/Foundations/UI/Function-Libraries/ActionSwitch.js index b37988487..52103191d 100644 --- a/Projects/Foundations/UI/Function-Libraries/ActionSwitch.js +++ b/Projects/Foundations/UI/Function-Libraries/ActionSwitch.js @@ -779,6 +779,50 @@ function newFoundationsActionSwitch() { UI.projects.foundations.functionLibraries.socialBotsFunctions.sendSlackTestMessage(action.node, action.callBackFunction) } break + case 'Copy Position': + { + UI.projects.foundations.utilities.clipboard.copyTextToClipboard( action.node.payload.position.x + ';' + action.node.payload.position.y) + action.node.payload.uiObject.setInfoMessage('Position copied') + } + break + case 'Snap to Position': + { + navigator.clipboard.readText() + .then(text => { + //console.log('Pasted content: ', text); + let newPosition = { + x: 0, + y: 0 + } + let newVector = { + x: 0, + y: 0 + } + let positionArray = text.split(";",2) + + newPosition.x = positionArray[0] + newPosition.y = positionArray[1] + + if (newPosition.x >= 0 && newPosition.x <= UI.projects.foundations.spaces.floatingSpace.container.frame.width) { + newVector.x = newPosition.x - action.node.payload.position.x + + if (newPosition.y >= 0 && newPosition.y <= UI.projects.foundations.spaces.floatingSpace.container.frame.height) { + + newVector.y = newPosition.y - action.node.payload.position.y + action.node.payload.floatingObject.container.displace(newVector) + action.node.payload.uiObject.setInfoMessage('Snapped to new position') + } + } + else { + action.node.payload.uiObject.setErrorMessage('[Error]:Failed to read clipboard contents') + } + }) + .catch(err => { + console.error('[Error]:Failed to read clipboard contents: ', err); + action.node.payload.uiObject.setErrorMessage('[Error]:Failed to read clipboard contents') + }); + } + break } } } diff --git a/Projects/Foundations/UI/Spaces/Floating-Space/UiObjectConstructor.js b/Projects/Foundations/UI/Spaces/Floating-Space/UiObjectConstructor.js index 1a5c0c8bd..32cbf727d 100644 --- a/Projects/Foundations/UI/Spaces/Floating-Space/UiObjectConstructor.js +++ b/Projects/Foundations/UI/Spaces/Floating-Space/UiObjectConstructor.js @@ -365,6 +365,38 @@ function newUiObjectConstructor() { } ) } + menuItemsInitialValues.push( + { + action: 'Copy Position', + actionFunction: floatingObject.payload.executeAction, + actionProject: 'Foundations', + label: undefined, + visible: true, + //placeholder icon : https://www.iconpacks.net/free-icon/pin-48.html + iconPathOn: 'copy-position', + iconPathOff: 'copy-position', + rawRadius: 12, + targetRadius: 0, + currentRadius: 0, + ring: 2 + } + ) + menuItemsInitialValues.push( + { + action: 'Snap to Position', + actionFunction: floatingObject.payload.executeAction, + actionProject: 'Foundations', + label: undefined, + visible: true, + //placeholder icon: https://www.iconpacks.net/free-icon/pins-53.html + iconPathOn: 'snap-position', + iconPathOff: 'snap-position', + rawRadius: 12, + targetRadius: 0, + currentRadius: 0, + ring: 2 + } + ) menuItemsInitialValues.push( { action: 'Parent Detach',