Bir okul projesi için, coğrafi bir etiket oyunu oluşturma düşüncesine sahibiz. Uygulamamıza giriş yaparsınız, konumunuz haritada gösterilir ve başka bir oyuncuya ne zaman yaklaşırsanız o kişiyi etiketlersiniz. (Çocuklar etiketi gibi ama meteor ile)Bir broşür haritasındaki bir işaretçiyi otomatik olarak nasıl güncellerim, meteor ile
Bulunduğumuz sorun, broşür haritamızdaki işaretçimizi otomatik olarak güncelleyemiyoruz. Sadece güncellenmediğini gösteren bir işaret var.
Player.update'i bir kerede kullanmayı denedik ama işe yaramıyor.
Herhangi bir öneriniz var mı?
Sen varolan işaretleri temizlemeniz gerekiyor 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/[email protected]/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 position of all markers
var marker = L.marker([players.latitude, players.longitude], options={"id" : 666}).addTo(map);
});
};
// If the collection of players changes (location or amount of players)
Meteor.autorun(function() {
var playersList = players.find().fetch();
playersList.forEach(function(players) {
// Change position of all markers
var marker = L.marker([players.latitude, players.longitude]).addTo(map);
});
});
}
if (Meteor.isServer) {
Meteor.startup(function() {
// code to run on server at startup
});
}
/*
Template.hello.events({
'click input' : function() {
// template data, if any, is available in 'this'
if (typeof console !== 'undefined')
console.log("You pressed the button");
}
});
*/
/*
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
userLatitude = 52.35873;
userLongitude = 4.908228;
players.insert({
name: "Martijn",
latitude: userLatitude,
longitude: userLongitude
});
});
}
*/
bu sorunla ilgili kod sonrası Lütfen –