Canvas SVG parser: Difference between revisions

m
Line 139: Line 139:


Bottom line being: 1) less code, 2) less typing, 3) better maintainable, 4) more future-proof  
Bottom line being: 1) less code, 2) less typing, 3) better maintainable, 4) more future-proof  
To port existing code (such as the 744 EICAS/PFD) accordingly, here's what you'll want to do:
* make sure that the SVG element's ID is indeed unique, also within the namespace of your hash/class, to avoid naming conflicts (if the ID is not unique, either introduce a sub namespace/hash, or simply open the SVG file and rename it)
* search/replace occurences of the old variable name and prepend a me. prefix, e.g. '''altitudeFt''' becomes '''me.altitudeFt'''
* remove/comment the free-standing '''var altitudeFt = {};''' line and replace it by adding the SVG element ID to the vector of the foreach loop


[[Category:Canvas]]
[[Category:Canvas]]
[[Category:Howto]]
[[Category:Howto]]