Super Actions Implemented
This commit is contained in:
1 parent
4cc57408ee
commit
882cdb7df2
22 files changed
+498
-23
No files matched your search
+6
-4
@@ -922,10 +922,12 @@ function newCanvas () {
|
||||
function checkDrag (event) {
|
||||
try {
|
||||
if (containerDragStarted === true || floatingObjectDragStarted === true || viewPortBeingDragged === true) {
|
||||
thisObject.mouse.event = event
|
||||
thisObject.mouse.position.x = event.pageX
|
||||
thisObject.mouse.position.y = event.pageY - CURRENT_TOP_MARGIN
|
||||
thisObject.mouse.action = 'dragging'
|
||||
if (event !== undefined) {
|
||||
thisObject.mouse.event = event
|
||||
thisObject.mouse.position.x = event.pageX
|
||||
thisObject.mouse.position.y = event.pageY - CURRENT_TOP_MARGIN
|
||||
thisObject.mouse.action = 'dragging'
|
||||
}
|
||||
|
||||
browserCanvas.style.cursor = 'grabbing'
|
||||
thisObject.eventHandler.raiseEvent('Dragging', undefined)
|
||||
|
||||
@@ -7,6 +7,7 @@ function newChainAttachDetach () {
|
||||
return thisObject
|
||||
|
||||
function chainDetachNode (node, rootNodes) {
|
||||
if (node.payload.parentNode === undefined) { return }
|
||||
switch (node.type) {
|
||||
case 'Phase': {
|
||||
let payload = node.payload
|
||||
|
||||
@@ -20,5 +20,8 @@ function newReferenceAttachDetach () {
|
||||
|
||||
function completeDetachment (node) {
|
||||
node.payload.referenceParent = undefined
|
||||
if (node.savedPayload !== undefined) {
|
||||
node.savedPayload.referenceParent = undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
function newSuperScriptsFunctions () {
|
||||
thisObject = {
|
||||
runSuperScript: runSuperScript
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
function runSuperScript (node, functionLibraryNodeCloning, functionLibraryUiObjectsFromNodes) {
|
||||
try {
|
||||
let clone = functionLibraryNodeCloning.getNodeClone
|
||||
let executionResult = true
|
||||
|
||||
function setup (templateClone, target) {
|
||||
spawnPosition.x = target.payload.position.x
|
||||
spawnPosition.y = target.payload.position.y
|
||||
|
||||
functionLibraryUiObjectsFromNodes.createUiObjectFromNode(templateClone, target, target)
|
||||
}
|
||||
|
||||
/* Validations */
|
||||
if (executionResult === true && node.payload.parentNode === undefined) {
|
||||
node.payload.uiObject.setErrorMessage('Super Action node needs a Parent Node.')
|
||||
executionResult = false
|
||||
}
|
||||
if (executionResult === true && node.payload.referenceParent === undefined) {
|
||||
node.payload.uiObject.setErrorMessage('Super Action node needs to reference a Master Script Node.')
|
||||
executionResult = false
|
||||
}
|
||||
if (executionResult === true && node.payload.referenceParent.javascriptCode === undefined) {
|
||||
node.payload.uiObject.setErrorMessage('Master Script Node needs to have a child Javascript Code Node.')
|
||||
executionResult = false
|
||||
}
|
||||
|
||||
let superAction = node
|
||||
let masterScript = node.payload.referenceParent
|
||||
|
||||
eval(masterScript.javascriptCode.code)
|
||||
|
||||
let masterScriptInstance = newNewMasterScriptInstance()
|
||||
|
||||
if (executionResult === true) {
|
||||
executionResult = masterScriptInstance.runValidations(superAction, masterScript)
|
||||
}
|
||||
if (executionResult === true) {
|
||||
executionResult = masterScriptInstance.runScript(superAction, masterScript)
|
||||
}
|
||||
if (executionResult === true) {
|
||||
superAction.payload.uiObject.setValue('Execution Completed Successfully')
|
||||
} else {
|
||||
superAction.payload.uiObject.setValue('Execution Failed')
|
||||
}
|
||||
} catch (err) {
|
||||
superAction.payload.uiObject.setErrorMessage(err.message)
|
||||
superAction.payload.uiObject.setValue('Execution Failed')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,6 +189,16 @@ function newUiObjectsFromNodes () {
|
||||
}
|
||||
}
|
||||
|
||||
/* Create Empty Arrays for properties of type Array */
|
||||
if (nodeDefinition.properties !== undefined) {
|
||||
for (let i = 0; i < nodeDefinition.properties.length; i++) {
|
||||
let property = nodeDefinition.properties[i]
|
||||
if (property.type === 'array') {
|
||||
object[property.name] = []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nodeDefinition !== undefined) {
|
||||
if (nodeDefinition.initialValues !== undefined) {
|
||||
if (nodeDefinition.initialValues.code !== undefined) {
|
||||
|
||||
@@ -56,6 +56,7 @@ function newWorkspace () {
|
||||
let functionLibrarySessionFunctions = newSessionFunctions()
|
||||
let functionLibraryShortcutKeys = newShortcutKeys()
|
||||
let functionLibraryOnFocus = newOnFocus()
|
||||
let functionLibrarySuperScripts = newSuperScriptsFunctions()
|
||||
|
||||
thisObject.nodeChildren = newNodeChildren()
|
||||
|
||||
@@ -366,6 +367,21 @@ function newWorkspace () {
|
||||
functionLibrarySessionFunctions.stopSession(payload.node, functionLibraryProtocolNode, callBackFunction)
|
||||
}
|
||||
break
|
||||
case 'Run Super Action':
|
||||
{
|
||||
functionLibrarySuperScripts.runSuperScript(payload.node, functionLibraryNodeCloning, functionLibraryUiObjectsFromNodes)
|
||||
}
|
||||
break
|
||||
case 'Remove Parent':
|
||||
{
|
||||
chainDetachNode(payload.node)
|
||||
}
|
||||
break
|
||||
case 'Remove Reference':
|
||||
{
|
||||
referenceDetachNode(payload.node)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,15 +150,15 @@ function newCircularMenuItem () {
|
||||
if (thisObject.type === 'Icon Only') {
|
||||
switch (thisObject.ring) {
|
||||
case 1: {
|
||||
radiusGrowthFactor = 5
|
||||
radiusGrowthFactor = 6
|
||||
break
|
||||
}
|
||||
case 2: {
|
||||
radiusGrowthFactor = 3.5
|
||||
radiusGrowthFactor = 4.5
|
||||
break
|
||||
}
|
||||
case 3: {
|
||||
radiusGrowthFactor = 2
|
||||
radiusGrowthFactor = 3
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -275,6 +275,7 @@ function newCircularMenuItem () {
|
||||
/* A Click during confirmation executes the pre-defined action. */
|
||||
if (temporaryStatus === STATUS_WAITING_CONFIRMATION || temporaryStatus === STATUS_PRIMARY_WORK_DONE) {
|
||||
executeAction()
|
||||
setStatus(thisObject.workDoneLabel, UI_COLOR.PATINATED_TURQUOISE, 100, STATUS_SECONDARY_WORK_DONE)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,6 +246,34 @@ function newUiObjectConstructor () {
|
||||
}
|
||||
)
|
||||
}
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Remove Parent',
|
||||
actionFunction: floatingObject.payload.onMenuItemClick,
|
||||
label: undefined,
|
||||
visible: true,
|
||||
iconPathOn: 'detach',
|
||||
iconPathOff: 'detach',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
ring: 3
|
||||
}
|
||||
)
|
||||
menuItemsInitialValues.push(
|
||||
{
|
||||
action: 'Remove Reference',
|
||||
actionFunction: floatingObject.payload.onMenuItemClick,
|
||||
label: undefined,
|
||||
visible: true,
|
||||
iconPathOn: 'delink',
|
||||
iconPathOff: 'delink',
|
||||
rawRadius: 8,
|
||||
targetRadius: 0,
|
||||
currentRadius: 0,
|
||||
ring: 3
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
function getMenuItemsInitialValues (uiObject, floatingObject, payload) {
|
||||
|
||||
@@ -141,6 +141,11 @@ function newUiObjectTitle () {
|
||||
}
|
||||
}
|
||||
|
||||
/* The name becomes the title. */
|
||||
if (thisObject.payload.node.name !== undefined) {
|
||||
thisObject.payload.title = thisObject.payload.node.name
|
||||
}
|
||||
|
||||
let title = trimTitle(thisObject.payload.title)
|
||||
|
||||
/* Here we set the dimensions and position of this object */
|
||||
|
||||
@@ -265,7 +265,16 @@ function newDesignSpace () {
|
||||
'key-down',
|
||||
'key-left',
|
||||
'key-right',
|
||||
'key-up'
|
||||
'key-up',
|
||||
'master-script',
|
||||
'scripts-library',
|
||||
'super-action',
|
||||
'super-scripts',
|
||||
'template-script',
|
||||
'template-structure',
|
||||
'template-target',
|
||||
'delink',
|
||||
'detach'
|
||||
]
|
||||
|
||||
for (let i = 0; i < iconsNames.length; i++) {
|
||||
|
||||
Reference in new issue
Block a user