Hyde wrote in Sat May 31, 2014 6:44 pm:@Philosopher
git main branch's canvas ND has not worked quite long time.
Could you update at least no nasal error and ND workable?
This is all fixed in the canvas-hackers repo, so we're aware of it - there are also quite a few improvements and optimizations coming up. This is all scheduled to go into 3.2, so no need to worry - like I mentioned previously when people asked about this, you could have simply applied the trivial patch that I posted to make it work:
Subject: NavDisplay & MapStructure discussion (previously via PM)
Hooray wrote:F-JYL wrote in Fri May 09, 2014 5:40 am:So can you tell what have to be done to make it usable again ?
Well, as I mentioned already previously, due to some recent refactoring, the .setRange()/getPosCoord() methods now need to be called prior to the MapStructure layers getting added (the constructors depend on those properties now), or you need to return early if any of those calls return nil (in searchCmd) - so as a quick workaround, something like the following one-liner should probably work if added to MapStructure.nas itself:
- Code: Select all
diff --git a/Nasal/canvas/MapStructure.nas b/Nasal/canvas/MapStructure.nas
index 1bc20fe..12778ce 100644
--- a/Nasal/canvas/MapStructure.nas
+++ b/Nasal/canvas/MapStructure.nas
@@ -484,6 +484,7 @@ var SymbolLayer = {
return nil;
},
searchCmd: func() {
+ if (me.map.getPosCoord() == nil or me.map.getRange() == nil) return []; # handle layers not yet fully initialized
var result = me.controller.searchCmd();
# some hardening TODO: don't do this always - only do it once during initialization, i.e. layer creation ?
var type=typeof(result);
This should check if the map isn't yet initialized properly (i.e. range/position being n/a), and return an empty set of results (i.e. a vector) instead of running the actual searchCmd() as provided by the MapStructure .lcontroller file, which "depends" on those properties being available now.