Moved actionStruct to be a class. Better that way
This commit is contained in:
parent
bf2e281c40
commit
5ce6dc6d3e
31
Web/ui.js
31
Web/ui.js
@ -182,7 +182,7 @@ function PrintScreen(WhatPassedIn=-1)
|
|||||||
//console.log("We have something selected.");
|
//console.log("We have something selected.");
|
||||||
var tmp_select = returnHighlightShape("selectbox", ui_selectRect, "green", "none", 0.8);
|
var tmp_select = returnHighlightShape("selectbox", ui_selectRect, "green", "none", 0.8);
|
||||||
drawshape(tmp_select);
|
drawshape(tmp_select);
|
||||||
}
|
}
|
||||||
|
|
||||||
drawSelectMenu();
|
drawSelectMenu();
|
||||||
PrintAllNetworkLinks();
|
PrintAllNetworkLinks();
|
||||||
@ -688,23 +688,22 @@ function makeLine(x1, y1, x2, y2, offsetx = 0, offsety = 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Make a structure to hold all our data
|
//Make a structure to hold all our data
|
||||||
function actionStruct(shapeText, shapePoints, theObject=null, funcLeftClick=null, funcRightClick=null, funcMouseover=null) {
|
class actionStruct {
|
||||||
var struct = {
|
constructor(shapeText, shapePoints, theObject=null, funcLeftClick=null, funcRightClick=null, funcMouseover=null) {
|
||||||
shapeText: shapeText,
|
|
||||||
shapePoints: structuredClone(shapePoints),
|
this.shapeText= shapeText
|
||||||
theObject: theObject,
|
this.shapePoints= structuredClone(shapePoints)
|
||||||
funcLeftClick: funcLeftClick,
|
this.shapePoints.shapeText = shapeText;
|
||||||
funcRightClick: funcRightClick,
|
this.theObject= theObject
|
||||||
funcMouseover: funcMouseover,
|
this.funcLeftClick= funcLeftClick
|
||||||
|
this.funcRightClick= funcRightClick
|
||||||
|
this.funcMouseover= funcMouseover
|
||||||
}
|
}
|
||||||
//if (shapeText == "line") console.log("Creating a line: " + JSON.stringify(struct));
|
|
||||||
shapePoints.shapeText = shapeText;
|
|
||||||
return struct;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerActionStruct(shapeText, shapePoints, theObject=null, funcLeftClick=null, funcRightClick=null, funcMouseover=null) {
|
function registerActionStruct(shapeText, shapePoints, theObject=null, funcLeftClick=null, funcRightClick=null, funcMouseover=null) {
|
||||||
//Make an object with all the data
|
//Make an object with all the data
|
||||||
var what = actionStruct(shapeText, shapePoints, theObject, funcLeftClick, funcRightClick, funcMouseover);
|
var what = new actionStruct(shapeText, shapePoints, theObject, funcLeftClick, funcRightClick, funcMouseover);
|
||||||
//console.log("Pushing an action: " + shapeText);
|
//console.log("Pushing an action: " + shapeText);
|
||||||
//Push it onto the uiActions list
|
//Push it onto the uiActions list
|
||||||
uiActions.unshift(what); //Put it at the beginning of the list
|
uiActions.unshift(what); //Put it at the beginning of the list
|
||||||
@ -881,9 +880,9 @@ function device_clickOn(point, actionrec) {
|
|||||||
//here we get all the problem statements and combine them
|
//here we get all the problem statements and combine them
|
||||||
errors = returnProblemStrings(actionrec.theObject);
|
errors = returnProblemStrings(actionrec.theObject);
|
||||||
additional = " " + errors.join(' - ');
|
additional = " " + errors.join(' - ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setStatus(actionrec.theObject.hostname + additional);
|
setStatus(actionrec.theObject.hostname + additional);
|
||||||
//We probably do not want to do printecreen here, but we are doing it here now...
|
//We probably do not want to do printecreen here, but we are doing it here now...
|
||||||
|
Loading…
Reference in New Issue
Block a user