Added possibility to specify position to gui.popupTip
This commit is contained in:
parent
2c0513816c
commit
4b806a36c2
2 changed files with 24 additions and 9 deletions
|
@ -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);
|
if(var y = me._haveNode(node, 'y') != nil ) {
|
||||||
var screenW = getprop('/sim/startup/xsize');
|
me.setInt("y", y);
|
||||||
me.setInt("x", (screenW - me._width) * 0.5);
|
} 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();
|
me.show();
|
||||||
# https://code.google.com/p/flightgear-bugs/issues/detail?id=1273
|
# https://code.google.com/p/flightgear-bugs/issues/detail?id=1273
|
||||||
# when tooltip is shown for some other reason, ensure it stays for
|
# 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);
|
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()
|
hide: func()
|
||||||
{
|
{
|
||||||
# this gets run repeatedly during mouse-moves
|
# this gets run repeatedly during mouse-moves
|
||||||
|
@ -365,7 +379,7 @@ var showMessage = func(node)
|
||||||
innerSetTooltip(node);
|
innerSetTooltip(node);
|
||||||
|
|
||||||
var timeout = node.getNode("delay");
|
var timeout = node.getNode("delay");
|
||||||
tooltip.showMessage( timeout != nil ? timeout.getValue() : nil );
|
tooltip.showMessage( timeout != nil ? timeout.getValue() : nil, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
var clearMessage = func(node)
|
var clearMessage = func(node)
|
||||||
|
|
|
@ -6,11 +6,12 @@
|
||||||
# comes along and wants to pop a tip up before your delay is finished,
|
# comes along and wants to pop a tip up before your delay is finished,
|
||||||
# you lose. :)
|
# 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) {
|
var showDialog = func(name) {
|
||||||
|
|
Loading…
Reference in a new issue