1
0
Fork 0

comments, bugfixes and use API

This commit is contained in:
Henning Stahlke 2019-01-12 23:03:39 +01:00 committed by James Turner
parent fb73705281
commit bdbd3848af
3 changed files with 21 additions and 8 deletions

View file

@ -999,7 +999,7 @@ SymbolLayer.Controller = {
addVisibilityListener: func() {
var m = me;
append(m.listeners, setlistener(
m.layer._node.getNode("visible"),
m.layer._node.getNode("visible",1),
func m.layer.update(),
#compile("m.layer.update()", "<layer visibility on node "~m.layer._node.getNode("visible").getPath()~" for layer "~m.layer.type~">"),
0,0
@ -1461,7 +1461,7 @@ OverlayLayer.Controller = {
addVisibilityListener: func() {
var m = me;
append(m.listeners, setlistener(
m.layer._node.getNode("visible"),
m.layer._node.getNode("visible", 1),
func m.layer.update(),
#compile("m.layer.update()", "<layer visibility on node "~m.layer._node.getNode("visible").getPath()~" for layer "~m.layer.type~">"),
0,0

View file

@ -1,3 +1,14 @@
#
# FlightGear canvas gui
# Namespace: canvas
#
# Classes:
# WindowButton
# Window
#
# see also api.nas
var gui = {
widgets: {},
focused_window: nil,
@ -99,15 +110,17 @@ var Window = {
{
var placements = me._canvas._node.getChildren("placement");
# Do not remove canvas if other placements exist
if( size(placements) > 1 )
if( size(placements) > 1 ) {
foreach(var p; placements)
{
if( p.getValue("type") == "window"
and p.getValue("id") == me.get("id") )
p.remove();
}
else
}
else {
me._canvas.del();
}
me._canvas = nil;
}
if (me._node != nil) {

View file

@ -49,7 +49,7 @@ DefaultStyle.widgets.button = {
},
setText: func(model, text)
{
me._label.set("text", text);
me._label.setText(text);
var min_width = math.max(80, me._label.maxWidth() + 16);
model.setLayoutMinimumSize([min_width, 16]);
@ -130,7 +130,7 @@ DefaultStyle.widgets.checkbox = {
},
setText: func(model, text)
{
me._label.set("text", text);
me._label.setText(text);
var min_width = me._label.maxWidth() + 24;
model.setLayoutMinimumSize([min_width, 18]);
@ -203,7 +203,7 @@ DefaultStyle.widgets.label = {
}
me._createElement("text", "text")
.set("text", text);
.setText(text);
var hfw_func = nil;
var min_width = me._text.maxWidth() + 4;
@ -330,7 +330,7 @@ DefaultStyle.widgets["line-edit"] = {
},
setText: func(model, text)
{
me._text.set("text", text);
me._text.setText(text);
model._onStateChange();
},
update: func(model)