Canvas ND framework: Difference between revisions

Jump to navigation Jump to search
m
mNo edit summary
Line 299: Line 299:


To get started, just copy the whole 747-400 section in NDStyles and rename it to match your needs. Once that is working (getting a 747-400 ND via the 777-200 identifier), you can simply replace the SVG file name and add your own update handlers to incrementally come up with your own ND.
To get started, just copy the whole 747-400 section in NDStyles and rename it to match your needs. Once that is working (getting a 747-400 ND via the 777-200 identifier), you can simply replace the SVG file name and add your own update handlers to incrementally come up with your own ND.
== Adding new MapStructure Layers ==
Open $FG_ROOT/Nasal/canvas/map/navdisplay.styles, navigate to the vector named '''layers''' and add your new layer, e.g. named "AA":
<syntaxhighlight lang="nasal">
{ name:'AA', isMapStructure:1, update_on:['toggle_range','toggle_airports','toggle_display_mode'],
                                predicate: func(nd, layer) {
                                        # toggle visibility here
                                        var visible=nd.get_switch('toggle_airports') and nd.in_mode('toggle_display_mode', ['MAP']);
                                        layer.group.setVisible( visible );
                                        if (visible) {
                                                #print("Updating MapStructure ND layer: AA");
                                                layer.update();
                                        }
                                }, # end of layer update predicate
                                'z-index': 1,
                        }, # end of AA layer
</syntaxhighlight>


== Development ==
== Development ==

Navigation menu