OSDN Git Service

commit the part that makes the map work
[automap/automap.git] / Automap / MapSRC / src / ViewFrameUtils.js
index dc35335..7693516 100644 (file)
@@ -1,5 +1,5 @@
 ViewFrame.initInfobox = function (ibox, iboxSlots) {
-
+       // TODO: make faster
        ViewFrame.chunks
                .chunkMetadataNames.forEach((item, i) => {
                        const slot = document.createElement('tr');
@@ -34,16 +34,31 @@ ViewFrame.prototype.updateEdges = function () {
        this.southChunk = Math.floor(this.south);
 };
 
+/**
+* dx and dy are the distances in chunks
+*/
 ViewFrame.prototype.moveCenter = function (dx, dy) {
        // to pan when we click on the map!
        this.x += (dx - this.width / 2) / this.zoom;
        this.y += (dy - this.height / 2) / this.zoom;
 };
+
+/**
+* x and y are positions in chunks
+*/
 ViewFrame.prototype.setCenter = function (x, y) {
        this.x = x;
        this.y = y;
 };
 
+/**
+* x and y are positions in BLOCKS!!!!
+*/
+ViewFrame.prototype.setBlockwiseCenter = function (x, y) {
+       this.x = x / this.zoom;
+       this.y = y / this.zoom;
+};
+
 ViewFrame.prototype.clear = function () {
        this.loadedChunksByName.clear();
        this.loadedChunksByCoords.clear();