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