Commits

Anonymous committed 0ad6773

Move scaling and pivoting from TerrainLayerSprite to MapContainer

  • Participants
  • Parent commits e5953b9

Comments (0)

Files changed (2)

web/src/map/map_container.dart

   HexMapDataManager dataManager;
 
   MapContainer() {
-    x = 0;
-    y = 0;
+    x = 400.0;
+    y = 300.0;
+    pivotX = 400.0;
+    pivotY = 300.0;
     hexPixelWidth = HEX_PIXEL_SIZE * 2.0;
     hexPixelHeight = math.sqrt(3) /2 * hexPixelWidth;
     vertOffset = 3/4 * hexPixelHeight;

web/src/map/terrain_layer.dart

   TerrainLayerRegionSprite currentVisibleRegion;
 
   TerrainLayerSprite(MapContainer this.mapContainer) {
-    // TODO: Move this elsewhere and un-hardwire it.
-    x = 400.0;
-    y = 300.0;
-    pivotX = 400.0;
-    pivotY = 300.0;
+    x = 0.0;
+    y = 0.0;
     this.addTo(mapContainer);
 
     mapRegions = new List<List>();
   }
 
   void panX(double pixels) {
-    pivotX += pixels;
+    mapContainer.pivotX += pixels;
   }
 
   void panY(double pixels) {
-    pivotY += pixels;
+    mapContainer.pivotY += pixels;
   }
 
 
     if(scaleAmount + scaleX < 0.8)
       return;
 
-    scaleX += scaleAmount;
-    scaleY += scaleAmount;
+    mapContainer.scaleX += scaleAmount;
+    mapContainer.scaleY += scaleAmount;
   }
 }