1
0
Fork 0

Merge commit 'refs/merge-requests/268' of https://gitorious.org/fg/fgdata into merge-requests/268

This commit is contained in:
Torsten Dreyer 2015-02-22 21:49:12 +01:00
commit 404fff889b
2 changed files with 24 additions and 9 deletions

View file

@ -229,11 +229,19 @@ var Tooltip = {
}
},
showMessage: func(timeout = nil)
showMessage: func(timeout = nil, node = nil)
{
me.setInt("y", getprop('/sim/startup/ysize') * 0.2);
var screenW = getprop('/sim/startup/xsize');
me.setInt("x", (screenW - me._width) * 0.5);
if(var y = me._haveNode(node, 'y') != nil ) {
me.setInt("y", y);
} else {
me.setInt("y", getprop('/sim/startup/ysize') * 0.2);
}
if(var x = me._haveNode(node, 'x') != nil) {
me.setInt("x", x);
} else {
var screenW = getprop('/sim/startup/xsize');
me.setInt("x", (screenW - me._width) * 0.5);
}
me.show();
# https://code.google.com/p/flightgear-bugs/issues/detail?id=1273
# when tooltip is shown for some other reason, ensure it stays for
@ -243,6 +251,12 @@ var Tooltip = {
me._hideTimer.restart(timeout or me.DELAY);
},
_haveNode: func(node, key) {
if(node == nil ) return nil;
var value = num(node.getValue(key) );
return value;
},
hide: func()
{
# this gets run repeatedly during mouse-moves
@ -365,7 +379,7 @@ var showMessage = func(node)
innerSetTooltip(node);
var timeout = node.getNode("delay");
tooltip.showMessage( timeout != nil ? timeout.getValue() : nil );
tooltip.showMessage( timeout != nil ? timeout.getValue() : nil, node);
}
var clearMessage = func(node)

View file

@ -6,11 +6,12 @@
# comes along and wants to pop a tip up before your delay is finished,
# you lose. :)
#
var popupTip = func(label, delay = nil, override = nil)
var popupTip = func(label, delay = nil, override = nil, position = nil)
{
fgcommand("show-message", props.Node.new({ "label": label, "delay":delay }));
if (position == nil) {
position = {};
}
fgcommand("show-message", props.Node.new({ "label": label, "delay":delay, "x": position['x'], "y": position['y'] }));
}
var showDialog = func(name) {