Moved actionStruct to be a class. Better that way
This commit is contained in:
parent
bf2e281c40
commit
5ce6dc6d3e
23
Web/ui.js
23
Web/ui.js
@ -688,23 +688,22 @@ function makeLine(x1, y1, x2, y2, offsetx = 0, offsety = 0) {
|
||||
}
|
||||
|
||||
//Make a structure to hold all our data
|
||||
function actionStruct(shapeText, shapePoints, theObject=null, funcLeftClick=null, funcRightClick=null, funcMouseover=null) {
|
||||
var struct = {
|
||||
shapeText: shapeText,
|
||||
shapePoints: structuredClone(shapePoints),
|
||||
theObject: theObject,
|
||||
funcLeftClick: funcLeftClick,
|
||||
funcRightClick: funcRightClick,
|
||||
funcMouseover: funcMouseover,
|
||||
class actionStruct {
|
||||
constructor(shapeText, shapePoints, theObject=null, funcLeftClick=null, funcRightClick=null, funcMouseover=null) {
|
||||
|
||||
this.shapeText= shapeText
|
||||
this.shapePoints= structuredClone(shapePoints)
|
||||
this.shapePoints.shapeText = shapeText;
|
||||
this.theObject= theObject
|
||||
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) {
|
||||
//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);
|
||||
//Push it onto the uiActions list
|
||||
uiActions.unshift(what); //Put it at the beginning of the list
|
||||
|
Loading…
Reference in New Issue
Block a user