BreezeMap: updated for OL4
Posted by mholmes on 21 Aug 2017 in Activity log
The BreezeMap code was not functioning with OL4, so it was pinned to OL3. I've now remedied that:
- Created a tag for the last version compatible with OL3, so that's available for anyone who needs it.
- There were two instances of using ol.animate, now removed; these were simple pan functions which were called in Map.beforeRender (also now removed). The replacement is simply to add a duration to the options provided to the ol.View.fit() function.
- There were two instances in my own code of style functions which made use of "this" to refer to the feature they belong to; I don't know why this actually worked in OL3, but it correctly broke in OL4. The fix was to replace "this" with "feature", which is the first parameter to the function.
- ol.View.fit() no longer needs a map.getSize() parameter; I've commented that out.
- The build target which downloads the latest OL version was hard-coded to version 3; rewrote that. The biggest issue turned out to be the change on my desktop to Java 8, which brings the Nashorn JS engine. Where Rhino uses importClass() to pull in Java classes, this isn't supported in Nashorn. There's a Moz compatibility shim which you can use. This gives me a clue about a similar error on Windows with the Diagnostics code.
Also updated our Campus Map site and the TEI 2017 map to use OL4.