Put markers at the center of nodes (#374)
* Put markers at the center of nodes * Do the fix on every objects
This commit is contained in:
parent
fcd321448f
commit
cbf58dfbf8
@ -117,7 +117,7 @@ export default L.LayerGroup.extend({
|
||||
return;
|
||||
}
|
||||
|
||||
marker = L.marker([obj.z, obj.x], {icon: icon});
|
||||
marker = L.marker([obj.z + 0.5, obj.x + 0.5], {icon: icon});
|
||||
popup = self.createPopup(obj);
|
||||
if (popup)
|
||||
marker.bindPopup(popup);
|
||||
|
@ -66,7 +66,7 @@ export default L.LayerGroup.extend({
|
||||
},
|
||||
|
||||
createMarker: function(plane) {
|
||||
let marker = L.marker([plane.pos.z, plane.pos.x], {icon: this.getIcon(plane)});
|
||||
let marker = L.marker([plane.pos.z + 0.5, plane.pos.x + 0.5], {icon: this.getIcon(plane)});
|
||||
|
||||
marker.bindPopup(this.createPopup(plane));
|
||||
|
||||
@ -115,7 +115,7 @@ export default L.LayerGroup.extend({
|
||||
if (this.currentObjects[plane.id]) {
|
||||
//marker exists
|
||||
let marker = this.currentObjects[plane.id];
|
||||
marker.setLatLng([plane.pos.z, plane.pos.x]);
|
||||
marker.setLatLng([plane.pos.z + 0.5, plane.pos.x + 0.5]);
|
||||
marker.setIcon(this.getIcon(plane));
|
||||
marker.setPopupContent(this.createPopup(plane));
|
||||
} else {
|
||||
|
@ -63,13 +63,13 @@ export default AbstractGeoJsonOverlay.extend({
|
||||
|
||||
//Add stations
|
||||
borders[bordername].forEach(function(entry){
|
||||
coords.push([entry.x, entry.z]);
|
||||
coords.push([entry.x + 0.5, entry.z + 0.5]);
|
||||
});
|
||||
|
||||
// closing border
|
||||
coords.push([
|
||||
borders[bordername][0].x,
|
||||
borders[bordername][0].z
|
||||
borders[bordername][0].x + 0.5,
|
||||
borders[bordername][0].z + 0.5
|
||||
]);
|
||||
|
||||
var feature = {
|
||||
|
@ -29,7 +29,7 @@ export default L.LayerGroup.extend({
|
||||
popupAnchor: [0, -32]
|
||||
});
|
||||
|
||||
var marker = L.marker([cart.pos.z, cart.pos.x], {icon: Icon});
|
||||
var marker = L.marker([cart.pos.z + 0.5, cart.pos.x + 0.5], {icon: Icon});
|
||||
var html = "<b>Minecart</b><hr>";
|
||||
html += "<b>Id: </b> " + cart.id + "<br>";
|
||||
|
||||
@ -64,7 +64,7 @@ export default L.LayerGroup.extend({
|
||||
|
||||
if (self.currentObjects[cart.id]){
|
||||
//marker exists
|
||||
self.currentObjects[cart.id].setLatLng([cart.pos.z, cart.pos.x]);
|
||||
self.currentObjects[cart.id].setLatLng([cart.pos.z + 0.5, cart.pos.x + 0.5]);
|
||||
//setPopupContent
|
||||
|
||||
} else {
|
||||
|
@ -57,7 +57,7 @@ export default L.LayerGroup.extend({
|
||||
},
|
||||
|
||||
createMarker: function(player) {
|
||||
const marker = L.marker([player.pos.z, player.pos.x], {icon: this.getIcon(player)});
|
||||
const marker = L.marker([player.pos.z + 0.5, player.pos.x + 0.5], {icon: this.getIcon(player)});
|
||||
|
||||
marker.bindPopup(this.createPopup(player), {minWidth: 220});
|
||||
return marker;
|
||||
@ -154,7 +154,7 @@ export default L.LayerGroup.extend({
|
||||
if (this.currentObjects[player.name]){
|
||||
//marker exists
|
||||
const marker = this.currentObjects[player.name];
|
||||
marker.setLatLng([player.pos.z, player.pos.x]);
|
||||
marker.setLatLng([player.pos.z + 0.5, player.pos.x + 0.5]);
|
||||
marker.setIcon(this.getIcon(player));
|
||||
marker.setPopupContent(this.createPopup(player));
|
||||
|
||||
|
@ -11,11 +11,11 @@ export default AbstractGeoJsonOverlay.extend({
|
||||
"geometry": {
|
||||
"type":"Polygon",
|
||||
"coordinates":[[
|
||||
[protector.x-5,protector.z-5],
|
||||
[protector.x-5,protector.z+6],
|
||||
[protector.x+6,protector.z+6],
|
||||
[protector.x+6,protector.z-5],
|
||||
[protector.x-5,protector.z-5]
|
||||
[protector.x-5 + 0.5,protector.z-5 + 0.5],
|
||||
[protector.x-5 + 0.5,protector.z+6 + 0.5],
|
||||
[protector.x+6 + 0.5,protector.z+6 + 0.5],
|
||||
[protector.x+6 + 0.5,protector.z-5 + 0.5],
|
||||
[protector.x-5 + 0.5,protector.z-5 + 0.5]
|
||||
]]
|
||||
},
|
||||
"properties":{
|
||||
|
@ -15,11 +15,11 @@ export default AbstractGeoJsonOverlay.extend({
|
||||
"geometry": {
|
||||
"type":"Polygon",
|
||||
"coordinates":[[
|
||||
[protector.x-5,protector.z-5],
|
||||
[protector.x-5,protector.z+6],
|
||||
[protector.x+6,protector.z+6],
|
||||
[protector.x+6,protector.z-5],
|
||||
[protector.x-5,protector.z-5]
|
||||
[protector.x-5 + 0.5,protector.z-5 + 0.5],
|
||||
[protector.x-5 + 0.5,protector.z+6 + 0.5],
|
||||
[protector.x+6 + 0.5,protector.z+6 + 0.5],
|
||||
[protector.x+6 + 0.5,protector.z-5 + 0.5],
|
||||
[protector.x-5 + 0.5,protector.z-5 + 0.5]
|
||||
]]
|
||||
},
|
||||
"properties":{
|
||||
|
@ -96,7 +96,7 @@ export default L.LayerGroup.extend({
|
||||
popupAnchor: [0, -16]
|
||||
});
|
||||
|
||||
var marker = L.marker([train.pos.z, train.pos.x], {icon: Icon});
|
||||
var marker = L.marker([train.pos.z + 0.5, train.pos.x + 0.5], {icon: Icon});
|
||||
marker.bindPopup(this.createPopup(train));
|
||||
|
||||
return marker;
|
||||
@ -134,7 +134,7 @@ export default L.LayerGroup.extend({
|
||||
if (this.currentObjects[train.id]){
|
||||
//marker exists
|
||||
let marker = this.currentObjects[train.id];
|
||||
marker.setLatLng([train.pos.z, train.pos.x]);
|
||||
marker.setLatLng([train.pos.z + 0.5, train.pos.x + 0.5]);
|
||||
marker.setPopupContent(this.createPopup(train));
|
||||
|
||||
} else {
|
||||
|
@ -115,13 +115,13 @@ export default AbstractGeoJsonOverlay.extend({
|
||||
if (pos == null) {
|
||||
console.warn("[Trainlines][linepath_from_prv]", "line "+linename, "block "+pos_to_string(entry), "index "+entry.attributes.index, "Invalid point:", p);
|
||||
} else {
|
||||
feat.coords.push([pos.x, pos.z]);
|
||||
feat.coords.push([pos.x + 0.5, pos.z + 0.5]);
|
||||
}
|
||||
});
|
||||
} else if (rail_pos) {
|
||||
feat.coords.push([rail_pos.x, rail_pos.z]);
|
||||
feat.coords.push([rail_pos.x + 0.5, rail_pos.z + 0.5]);
|
||||
} else {
|
||||
feat.coords.push([entry.x, entry.z]);
|
||||
feat.coords.push([entry.x + 0.5, entry.z + 0.5]);
|
||||
}
|
||||
|
||||
if (entry.attributes.station) {
|
||||
|
@ -50,7 +50,7 @@ export default L.LayerGroup.extend({
|
||||
createMarker: function(signal){
|
||||
|
||||
var Icon = signal.green ? IconOn : IconOff;
|
||||
var marker = L.marker([signal.pos.z, signal.pos.x], {icon: Icon});
|
||||
var marker = L.marker([signal.pos.z + 0.5, signal.pos.x + 0.5], {icon: Icon});
|
||||
marker.bindPopup(this.createPopup(signal));
|
||||
|
||||
return marker;
|
||||
@ -89,7 +89,7 @@ export default L.LayerGroup.extend({
|
||||
if (this.currentObjects[signalId]){
|
||||
//marker exists
|
||||
let marker = this.currentObjects[signalId];
|
||||
marker.setLatLng([signal.pos.z, signal.pos.x]);
|
||||
marker.setLatLng([signal.pos.z + 0.5, signal.pos.x + 0.5]);
|
||||
marker.setPopupContent(this.createPopup(signal));
|
||||
marker.setIcon(signal.green ? IconOn : IconOff);
|
||||
|
||||
|
@ -11,11 +11,11 @@ export default AbstractGeoJsonOverlay.extend({
|
||||
"geometry": {
|
||||
"type":"Polygon",
|
||||
"coordinates":[[
|
||||
[protector.x-5,protector.z-5],
|
||||
[protector.x-5,protector.z+6],
|
||||
[protector.x+6,protector.z+6],
|
||||
[protector.x+6,protector.z-5],
|
||||
[protector.x-5,protector.z-5]
|
||||
[protector.x-5 + 0.5,protector.z-5 + 0.5],
|
||||
[protector.x-5 + 0.5,protector.z+6 + 0.5],
|
||||
[protector.x+6 + 0.5,protector.z+6 + 0.5],
|
||||
[protector.x+6 + 0.5,protector.z-5 + 0.5],
|
||||
[protector.x-5 + 0.5,protector.z-5 + 0.5]
|
||||
]]
|
||||
},
|
||||
"properties":{
|
||||
|
Loading…
Reference in New Issue
Block a user