If in doubt, refer to $FG_ROOT/Nasal/canvas/api.nas to see what else can be done at the superclass level: https://sourceforge.net/p/flightgear/fg ... as/api.nas
Note that you can directly access the transformation matrix, but also use dedicated helpers for scaling purposes:
- Code: Select all
# Shortcut for setting scale
setScale: func { me._getTf().setScale(arg); return me; },
# Shortcut for getting scale
getScale: func me._getTf().getScale(),
My suggestion would be to look at your original zooming/panning work in the airports.xml dialog - I cannot think of any good reason why people should not be able to customize the size of the display by using the mouse wheel incrementing/decrementing scale by 0.1%, what do you think ?
Regarding tooltips, like I said, you could take a look at rleibner's recently developed oscilloscope/gca addons - both are using tooltips IIRC.
The tooltip API is in $FG_ROOT/Nasal/canvas/tooltip.nas: https://sourceforge.net/p/flightgear/fg ... ooltip.nas
This is one of those features that got actually documented (originally by James): http://wiki.flightgear.org/Tooltips
More examples can be found by "grep"ing for "tooltip".
From an integration standpoint, you will want to register a "mouseover" listener for the hotspots: http://wiki.flightgear.org/Canvas_Event ... vent_types
The tooltip string could be added to the vector with hashes, i.e. for each hot-spot one "tooltip" key.
That being said, you might not just want to display a tooltip - but also change the mouse cursor. That, too, can be accomplished via Nasal, see $FG_ROOT/Nasal/gui.nas (line 60):
- Code: Select all
##
# Set mouse cursor coordinates and shape (number or name), and return
# current shape (number).
#
# Example: var cursor = gui.setCursor();
# gui.setCursor(nil, nil, "wait");
#
var setCursor = func(x = nil, y = nil, cursor = nil) {
var args = props.Node.new();
if (x != nil) args.getNode("x", 1).setIntValue(x);
if (y != nil) args.getNode("y", 1).setIntValue(y);
if (cursor != nil) {
if (num(cursor) == nil)
cursor = cursor_types[cursor];
if (cursor == nil)
die("cursor must be one of: " ~ string.join(", ", keys(cursor_types)));
setprop("/sim/mouse/hide-cursor", cursor);
args.getNode("cursor", 1).setIntValue(cursor);
}
fgcommand("set-cursor", args);
return args.getValue("cursor");
}
Besides, using the same APIs, it should also be possible to animate buttons/dials to respond to events -e.g. by zooming in or when the dial is selected.
Anyway, hope that helps for now.