You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thanks again for this great library! It really helps connecting p5.js with tile maps. While playing around, I have had a small issue:
I cannot seem to call the map.on('load') method. I would need this functionality to handle events on the map object after it is initialized. Here is what I have come up with so far:
let token = "xxx";
let mappa = new Mappa("Mapboxgl", token);
let myMap;
let canvas;
function setup(){
canvas = createCanvas(windowWidth, windowHeight);
myMap = mappa.tileMap(mapOptions); // lat 0, lng 0, zoom 4
myMap.overlay(canvas);
let mapObject = myMap.map;
mapObject.on("load", function(){
console.log("Map is ready!");
})
}
When doing this, I get the following error:
Could you maybe help out?
The text was updated successfully, but these errors were encountered:
lettoken="xxx";letmappa=newMappa("Mapboxgl",token);letmyMap;letcanvas;functionsetup(){canvas=createCanvas(windowWidth,windowHeight);myMap=mappa.tileMap(0,0,4);// lat 0, lng 0, zoom 4// you can pass a callback that will execute when the map is loaded and the p5 canvas is ready.myMap.overlay(canvas,startListeningToEvents);}functionstartListeningToEvents(){myMap.map.on("load",function(){console.log("Map is ready!");})myMap.map.on("move",function(){console.log("Map is moving");})}
I need to update the readme to show how to use that callback
Hi Cristóbal,
thanks again for this great library! It really helps connecting p5.js with tile maps. While playing around, I have had a small issue:
I cannot seem to call the map.on('load') method. I would need this functionality to handle events on the map object after it is initialized. Here is what I have come up with so far:
When doing this, I get the following error:
Could you maybe help out?
The text was updated successfully, but these errors were encountered: