| 1 |
var GUI = |
| 2 |
{ |
| 3 |
|
| 4 |
new : func(isfd, isfd_canvas, scale = 1.0) |
| 5 |
{ |
| 6 |
var obj = { |
| 7 |
parents : [ GUI ], |
| 8 |
isfd : isfd, |
| 9 |
width : 528, |
| 10 |
height : 528, |
| 11 |
scale : scale |
| 12 |
}; |
| 13 |
|
| 14 |
obj.window = canvas.Window.new([obj.scale*obj.width,obj.scale*obj.height],"dialog").set('title',"ISFD"); |
| 15 |
|
| 16 |
obj.window.del = func() { |
| 17 |
# Over-ride the window.del function so we clean up when the user closes the window |
| 18 |
# Use call method to ensure we have the correct closure. |
| 19 |
call(obj.cleanup, [], obj); |
| 20 |
}; |
| 21 |
|
| 22 |
# creating the top-level/root group which will contain all other elements/group |
| 23 |
obj.myCanvas = obj.window.createCanvas(); |
| 24 |
obj.myCanvas.set("name", "ISFD"); |
| 25 |
obj.root = obj.myCanvas.createGroup(); |
| 26 |
|
| 27 |
# Project the canvas onto the dialog |
| 28 |
var mfd_child = obj.root.createChild("image") |
| 29 |
.setFile(isfd_canvas.getPath()) |
| 30 |
.set("z-index", 150) |
| 31 |
.setTranslation(obj.scale*8,obj.scale*8) |
| 32 |
.setSize(obj.scale*512, obj.scale*512); |
| 33 |
|
| 34 |
|
| 35 |
# Create the surround fascia, which is just a PNG image; |
| 36 |
var child = obj.root.createChild("image") |
| 37 |
.setFile("Aircraft/Instruments-3d/ISFD/fascia.png") |
| 38 |
.set("z-index", 100) |
| 39 |
.setTranslation(0, 0) |
| 40 |
.setSize(obj.scale*obj.width,obj.scale*obj.height); |
| 41 |
|
| 42 |
|
| 43 |
return obj; |
| 44 |
}, |
| 45 |
|
| 46 |
cleanup : func() |
| 47 |
{ |
| 48 |
me.isfd.del(); |
| 49 |
# Clean up the window itself |
| 50 |
call(canvas.Window.del, [], me.window); |
| 51 |
}, |
| 52 |
}; |