- make deleting work even when 'flashing' of selected object is in progress
- fix object counter (which did often not go down to zero)
This commit is contained in:
parent
9f37927237
commit
e17146bdfa
1 changed files with 34 additions and 20 deletions
|
@ -480,6 +480,9 @@ Dynamic = {
|
||||||
m.node.getNode("pitch-deg-prop", 1).setValue(adjust.outNode("pitch").getPath());
|
m.node.getNode("pitch-deg-prop", 1).setValue(adjust.outNode("pitch").getPath());
|
||||||
m.node.getNode("roll-deg-prop", 1).setValue(adjust.outNode("roll").getPath());
|
m.node.getNode("roll-deg-prop", 1).setValue(adjust.outNode("roll").getPath());
|
||||||
m.load();
|
m.load();
|
||||||
|
m.flash_count = 0;
|
||||||
|
m.visible = 1;
|
||||||
|
m.on_flash_exit_func = func {};
|
||||||
return m;
|
return m;
|
||||||
},
|
},
|
||||||
del : func {
|
del : func {
|
||||||
|
@ -489,11 +492,11 @@ Dynamic = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
make_static : func {
|
make_static : func {
|
||||||
var static = Static.new(me.path, adjust.legendN.getValue(),
|
me.del();
|
||||||
|
me.flash(0);
|
||||||
|
return Static.new(me.path, adjust.legendN.getValue(),
|
||||||
adjust.get("lon"), adjust.get("lat"), adjust.get("elev"),
|
adjust.get("lon"), adjust.get("lat"), adjust.get("elev"),
|
||||||
adjust.get("hdg"), adjust.get("pitch"), adjust.get("roll"));
|
adjust.get("hdg"), adjust.get("pitch"), adjust.get("roll"));
|
||||||
me.del();
|
|
||||||
return static;
|
|
||||||
},
|
},
|
||||||
distance_from : func(xyz) {
|
distance_from : func(xyz) {
|
||||||
var lon = adjust.get("lon");
|
var lon = adjust.get("lon");
|
||||||
|
@ -501,6 +504,7 @@ Dynamic = {
|
||||||
return coord_dist_sq(xyz, lonlat2xyz([lon, lat]));
|
return coord_dist_sq(xyz, lonlat2xyz([lon, lat]));
|
||||||
},
|
},
|
||||||
get_data : func {
|
get_data : func {
|
||||||
|
me.flash(0);
|
||||||
var n = props.Node.new();
|
var n = props.Node.new();
|
||||||
n.getNode("path", 1).setValue(me.path);
|
n.getNode("path", 1).setValue(me.path);
|
||||||
props.copy(props.globals.getNode("/data/adjust"), n);
|
props.copy(props.globals.getNode("/data/adjust"), n);
|
||||||
|
@ -508,6 +512,28 @@ Dynamic = {
|
||||||
me.add_derived_props(n);
|
me.add_derived_props(n);
|
||||||
return n;
|
return n;
|
||||||
},
|
},
|
||||||
|
flash : func(v, fun = nil) {
|
||||||
|
me.flash_count = v;
|
||||||
|
if (fun != nil) {
|
||||||
|
me.on_flash_exit_func = fun;
|
||||||
|
}
|
||||||
|
me._flash_();
|
||||||
|
},
|
||||||
|
_flash_ : func {
|
||||||
|
if (!me.visible) {
|
||||||
|
adjust.set("elev", adjust.get("elev") + 10000);
|
||||||
|
me.visible = 1;
|
||||||
|
} elsif (me.flash_count) {
|
||||||
|
adjust.set("elev", adjust.get("elev") - 10000);
|
||||||
|
me.visible = 0;
|
||||||
|
}
|
||||||
|
if (me.flash_count) {
|
||||||
|
me.flash_count -= 1;
|
||||||
|
settimer(func { me._flash_() }, 0.3);
|
||||||
|
} else {
|
||||||
|
me.on_flash_exit_func();
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -590,21 +616,10 @@ ModelMgr = {
|
||||||
me.static = left;
|
me.static = left;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (me.dynamic == nil) { # last one removed
|
if (me.dynamic != nil) { # last one removed
|
||||||
return;
|
me.dynamic.flash(4);
|
||||||
}
|
}
|
||||||
me.flash();
|
me.display_status(me.modelpath);
|
||||||
},
|
|
||||||
flash : func {
|
|
||||||
me.block = 1;
|
|
||||||
var t = 0.33;
|
|
||||||
me.display_status(me.dynamic.path, 1);
|
|
||||||
settimer(func { adjust.set("elev", adjust.get("elev") - 10000) }, t);
|
|
||||||
settimer(func { adjust.set("elev", adjust.get("elev") + 10000) }, t * 2);
|
|
||||||
settimer(func { adjust.set("elev", adjust.get("elev") - 10000) }, t * 3);
|
|
||||||
settimer(func { adjust.set("elev", adjust.get("elev") + 10000) }, t * 4);
|
|
||||||
settimer(func { me.block = 0 }, t * 4.5);
|
|
||||||
settimer(func { me.display_status(me.modelpath) }, 5);
|
|
||||||
},
|
},
|
||||||
remove_selected : func {
|
remove_selected : func {
|
||||||
if (me.block) {
|
if (me.block) {
|
||||||
|
@ -620,9 +635,8 @@ ModelMgr = {
|
||||||
me.modelpath = path;
|
me.modelpath = path;
|
||||||
me.display_status(path);
|
me.display_status(path);
|
||||||
},
|
},
|
||||||
display_status : func(p, m = 0) {
|
display_status : func(p) {
|
||||||
var count = me.dynamic != nil;
|
var count = (me.dynamic == nil ? 0 : 1) + size(me.static);
|
||||||
count += size(me.static);
|
|
||||||
setprop("/sim/model/ufo/status", "(" ~ count ~ ") " ~ p);
|
setprop("/sim/model/ufo/status", "(" ~ count ~ ") " ~ p);
|
||||||
},
|
},
|
||||||
get_data : func {
|
get_data : func {
|
||||||
|
|
Loading…
Reference in a new issue