1 ViewFrame.initInfobox = function (ibox, iboxSlots) {
4 .chunkMetadataNames.forEach((item, i) => {
5 const slot = document.createElement('tr');
6 const head = document.createElement('th');
8 const row = document.createElement('td');
11 slot.append(head, row);
16 ViewFrame.prototype.updateEdges = function () {
17 if (this.width != window.innerWidth || this.height != window.innerHeight) {
18 this.width = window.innerWidth;
19 this.map.canvas.width = this.width;
20 this.height = window.innerHeight;
21 this.map.canvas.height = this.height;
22 this.map.imageSmoothingEnabled = false;
24 const chunksWide = Math.ceil(this.width / this.zoom);
25 const chunksHigh = Math.ceil(this.height / this.zoom);
27 this.east = this.x + chunksWide / 2; // this is fractional and is used to keep track of the edges of the window
28 this.eastChunk = Math.ceil(this.east); // this is not and is used to track the chunks that need to load
29 this.west = this.x - chunksWide / 2;
30 this.westChunk = Math.floor(this.west);
31 this.north = this.y + chunksHigh / 2;
32 this.northChunk = Math.ceil(this.north);
33 this.south = this.y - chunksHigh / 2;
34 this.southChunk = Math.floor(this.south);
37 ViewFrame.prototype.moveCenter = function (dx, dy) {
38 // to pan when we click on the map!
39 this.x += (dx - this.width / 2) / this.zoom;
40 this.y += (dy - this.height / 2) / this.zoom;
42 ViewFrame.prototype.setCenter = function (x, y) {
47 ViewFrame.prototype.clear = function () {
48 this.loadedChunksByName.clear();
49 this.loadedChunksByCoords.clear();
50 if (this.chunkScript) this.chunkScript.remove();
51 delete this.chunkScript;
52 delete ViewFrame.chunks;
53 this.map.clearRect(0, 0, window.innerWidth, window.innerHeight);
56 function decode(img, cb) {
61 .catch(() => {}); // so images arent added on error