1
0
Fork 0

Revert to 8e3ef0d2e4 as Nasal OOP doesn't work

This commit is contained in:
Erik Hofman 2023-03-10 09:21:54 +01:00
parent c9dda8b418
commit 534c859cdb

View file

@ -1,24 +1,20 @@
var testDialog = {
cDefaultGroup : 0,
shape: func() {
me.cDefaultGroup.createChild("path")
.setColorFill(0,0,0)
.setColor(0,0,0);
},
label: func(desc,posx,posy,rot=0) {
me.cDefaultGroup.createChild("text", desc)
.setRotation(rot*0.0174532925)
.setTranslation(posx,posy)
.setAlignment("center-top")
.setFont("typewriter.txf")
.setFontSize(40,1.5)
.setColor(0,0,0)
.setText(desc);
shape: func(cDefaultGroup) {
cDefaultGroup.createChild("path")
.setColorFill(0,0,0)
.setColor(0,0,0);
},
label: func(cDefaultGroup,desc,posx,posy,rot=0) {
cDefaultGroup.createChild("text", desc)
.setRotation(rot*0.0174532925)
.setTranslation(posx,posy)
.setAlignment("center-top")
.setFont("typewriter.txf")
.setFontSize(40,1.5)
.setColor(0,0,0)
.setText(desc);
},
create_tbl: func(needle_tbl) {
# hash table for needle positions
for (var i=1; i<21; i = i+1) {
@ -146,7 +142,6 @@ var testDialog = {
needles.close();
}
},
new: func(width=400,height=500)
{
var m = {
@ -166,52 +161,43 @@ var testDialog = {
m._dlg.setCanvas(cDisplay);
me.cDefaultGroup = cDisplay.createGroup();
var cDefaultGroup = cDisplay.createGroup();
var arrow = testDialog.shape();
var arrow = testDialog.shape(cDefaultGroup);
arrow.moveTo(0,0);
arrow.lineTo(400,550);
arrow.lineTo(400,500);
arrow.lineTo(450,500);
arrow.close();
var sqbl = testDialog.shape();
var sqbl = testDialog.shape(cDefaultGroup);
sqbl.moveTo(0,1000);
sqbl.lineTo(20,900);
sqbl.lineTo(100,980);
sqbl.close();
var sqbr = testDialog.shape();
var sqbr = testDialog.shape(cDefaultGroup);
sqbr.moveTo(800,1000);
sqbr.lineTo(780,900);
sqbr.lineTo(700,980);
sqbr.close();
var sqtr = testDialog.shape();
var sqtr = testDialog.shape(cDefaultGroup);
sqtr.moveTo(800,0);
sqtr.lineTo(780,100);
sqtr.lineTo(700,20);
sqtr.close();
return m;
},
update : func()
{
var needle_tbl = [[0,0,0,0,0,0,0,0,0,0]];
testDialog.create_tbl(needle_tbl);
var needles = testDialog.shape();
var needles = testDialog.shape(cDefaultGroup);
testDialog.draw_vario(needles,needle_tbl,400,500);
testDialog.label("TOP",400,5,0.0);
testDialog.label("LEFT",5,500,-90.0);
testDialog.label("RIGHT",795,500,90.0);
testDialog.label("BOTTOM",400,995,180.0);
}
};
testDialog.label(cDefaultGroup,"TOP",400,5,0.0);
testDialog.label(cDefaultGroup,"LEFT",5,500,-90.0);
testDialog.label(cDefaultGroup,"RIGHT",795,500,90.0);
testDialog.label(cDefaultGroup,"BOTTOM",400,995,180.0);
var rtimer = maketimer(0.2, func {
testDialog.update();
});
rtimer.start();
#testDialog.new();
return m;
},
};