Closed WillySuMapSense closed 9 years ago
In https://github.com/mapsense/polymaps-examples/blob/master/tile-browser.js, I found following code:
var map = po.map() .container(mapDiv.append('svg') .... var tj = po.d3TopoJson() .url(url) .... map.add(tj);
However, when I changed the variable name "var map" to something else such as "var map1":
var map1 = po.map() .container(mapDiv.append('svg') .... var tj = po.d3TopoJson() .url(url) .... map1.add(tj);
It gave me following error message in polymaps.js (lines 1586~1589): "Uncaught ReferenceError: map is not defined"
d3.select(g.insertBefore(po.svg("rect"), g.firstChild)) .attr("width", map.tileSize().x) .attr("height", map.tileSize().x) .attr("class", "rectile");
I found out that "map" in "map.tileSize" is undefined and was used the global variable "map".
It seems to be the same case in lines 988~989
layer.map = function(x) { if (!arguments.length) return map;
"map" in "return map" is using the global variable "map".
Expect: Polymaps will work even we don't declare global variable "map".
In https://github.com/mapsense/polymaps-examples/blob/master/tile-browser.js, I found following code:
var map = po.map() .container(mapDiv.append('svg') .... var tj = po.d3TopoJson() .url(url) .... map.add(tj);
However, when I changed the variable name "var map" to something else such as "var map1":
var map1 = po.map() .container(mapDiv.append('svg') .... var tj = po.d3TopoJson() .url(url) .... map1.add(tj);
It gave me following error message in polymaps.js (lines 1586~1589): "Uncaught ReferenceError: map is not defined"
I found out that "map" in "map.tileSize" is undefined and was used the global variable "map".
It seems to be the same case in lines 988~989
layer.map = function(x) { if (!arguments.length) return map;
"map" in "return map" is using the global variable "map".
Expect: Polymaps will work even we don't declare global variable "map".