Quellcode durchsuchen

setting x/y will keep constant width/height

ncannasse vor 10 Jahren
Ursprung
Commit
444082a05f
1 geänderte Dateien mit 6 neuen und 4 gelöschten Zeilen
  1. 6 4
      h2d/col/Bounds.hx

+ 6 - 4
h2d/col/Bounds.hx

@@ -49,8 +49,8 @@ class Bounds {
 	}
 	}
 
 
 	public inline function set(x, y, width, height) {
 	public inline function set(x, y, width, height) {
-		this.x = x;
-		this.y = y;
+		this.xMin = x;
+		this.yMin = y;
 		this.xMax = x + width;
 		this.xMax = x + width;
 		this.yMax = y + height;
 		this.yMax = y + height;
 	}
 	}
@@ -186,11 +186,13 @@ class Bounds {
 		return yMin;
 		return yMin;
 	}
 	}
 
 
-	inline function set_x(x) {
+	inline function set_x(x:Float) {
+		xMax += x - xMin;
 		return xMin = x;
 		return xMin = x;
 	}
 	}
 
 
-	inline function set_y(y) {
+	inline function set_y(y:Float) {
+		yMax += y - yMin;
 		return yMin = y;
 		return yMin = y;
 	}
 	}