forked from blurryface/Website
feat: update map
This commit is contained in:
parent
c5119f6b31
commit
e3d70829ec
|
@ -4,27 +4,54 @@
|
||||||
<a id="homeLink" href="/">Go Home</a>
|
<a id="homeLink" href="/">Go Home</a>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
let mapLayer = L.tileLayer('https://cdn.theclashfruit.me/crss/map/tile_{x}x{y}y.png', {
|
L.TileLayer.CRSSLayer = L.TileLayer.extend({
|
||||||
attribution: '© <a href="https://crss.blurryface.xyz/">CRSS</a> players',
|
getTileUrl: function(coordinate) {
|
||||||
noWrap: true,
|
const tileX = coordinate.x;
|
||||||
maxNativeZoom: 4,
|
const tileY = coordinate.y;
|
||||||
minNativeZoom: 4,
|
|
||||||
|
const url = ('https://cdn.theclashfruit.me/crss/map_new/{xd}/{yd}/tile.{x}.{y}.png')
|
||||||
|
.replace('{yd}', Math.floor(tileY / 10))
|
||||||
|
.replace('{xd}', Math.floor(tileX / 10))
|
||||||
|
.replace('{y}', tileY)
|
||||||
|
.replace('{x}', tileX);
|
||||||
|
|
||||||
|
return url;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let spawnTown = L.marker([-36.3, -41.3])
|
L.tileLayer.crssLayer = function(templateUrl, options) {
|
||||||
.bindPopup('Spawn Town in Republic of Panorama');
|
return new L.TileLayer.CRSSLayer(templateUrl, options);
|
||||||
|
}
|
||||||
|
|
||||||
let notchTemple = L.marker([-71, -51.8])
|
let mapLayer = L.tileLayer.crssLayer('https://cdn.theclashfruit.me/crss/map_new/{x}/{y}/tile.{x}.{y}.png', {
|
||||||
.bindPopup('The Temple of Notch (<a href="https://www.planetminecraft.com/project/the-shrine-of-notch/">Original Map</a>)');
|
attribution: '© <a href="https://crss.blurryface.xyz/">CRSS</a> players',
|
||||||
|
noWrap: true,
|
||||||
|
maxNativeZoom: 0,
|
||||||
|
minNativeZoom: 0,
|
||||||
|
origin: [0, 0],
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
const worldMinX = -3 * 512;
|
||||||
|
const worldMinY = -7 * 512;
|
||||||
|
const worldWidth = (8 + 1 - (-3)) * 512;
|
||||||
|
const worldHeight = (4 + 1 - (-7)) * 512;
|
||||||
|
|
||||||
|
const worldTileSize = 256;
|
||||||
|
|
||||||
|
const worldMaxZoomFactor = Math.pow(2, 0);
|
||||||
|
|
||||||
|
let spawnTown = L.marker([0, 0])
|
||||||
|
.bindPopup('0; 0');
|
||||||
|
|
||||||
let markers = L.layerGroup([
|
let markers = L.layerGroup([
|
||||||
spawnTown,
|
spawnTown
|
||||||
notchTemple
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let map = L.map('map', {
|
let map = L.map('map', {
|
||||||
layers: [mapLayer, markers]
|
layers: [mapLayer, markers],
|
||||||
}).setView([-36.3, -41.3], 4);
|
crs: L.CRS.Simple,
|
||||||
|
}).setView([0, 0], 4);
|
||||||
|
|
||||||
let baseMaps = {
|
let baseMaps = {
|
||||||
"Overworld": mapLayer
|
"Overworld": mapLayer
|
||||||
|
|
Loading…
Reference in a new issue