对于一个学校项目,我们有这个想法制作一个地理空间标签游戏.您登录我们的应用程序,您的位置显示在地图上,每当您接近其他玩家时,您都会标记该人.(就像孩子的标签,但有流星)
我们遇到的问题,我们似乎无法在传单地图上自动更新我们的标记.有一个标记显示它没有更新.
我们尝试过一次使用Player.update但它不起作用.
有什么建议?
代码
if (Meteor.isClient) {
var userLatitude;
var userLongitude;
var map;
Template.map.rendered = function () {
// Setup map
map = new L.map('map', {
dragging: false,
zoomControl: false,
scrollWheelZoom: false,
doubleClickZoom: false,
boxZoom: false,
touchZoom: false
});
map.setView([52.35873, 4.908228], 17);
//map.setView([51.9074877, 4.4550772], 17);
L.tileLayer('http://{s}.tile.cloudmade.com/9950b9eba41d491090533c541f170f3e/997@2x/256/{z}/{x}/{y}.png', {
maxZoom: 17
}).addTo(map);
// If user has location then place marker on map
if (userLatitude && userLongitude) {
var marker = L.marker([userLatitude, userLongitude]).addTo(map);
}
var playersList = players.find().fetch();
playersList.forEach(function(players) {
// Change …Run Code Online (Sandbox Code Playgroud)