Jelajahi Sumber

Separate h2d Flow background creation to be overridable

Leonardo Jeanteur 2 bulan lalu
induk
melakukan
3dee2528ee
1 mengubah file dengan 17 tambahan dan 10 penghapusan
  1. 17 10
      h2d/Flow.hx

+ 17 - 10
h2d/Flow.hx

@@ -1073,20 +1073,27 @@ class Flow extends Object {
 		}
 		}
 	}
 	}
 
 
+	public function makeBackground(tile) {
+		return new h2d.ScaleGrid(tile, borderLeft, borderTop, borderRight, borderBottom);
+	}
+
+	function buildBackground(tile) {
+		var background = makeBackground(tile);
+		addChildAt(background, 0);
+		getProperties(background).isAbsolute = true;
+		this.background = background;
+		if( !needReflow ) {
+			background.width = flowCeil(calculatedWidth);
+			background.height = flowCeil(calculatedHeight);
+		}
+	}
+
 	function set_backgroundTile(t) {
 	function set_backgroundTile(t) {
 		if( backgroundTile == t )
 		if( backgroundTile == t )
 			return t;
 			return t;
 		if( t != null ) {
 		if( t != null ) {
-			if( background == null ) {
-				var background = new h2d.ScaleGrid(t, borderLeft, borderTop, borderRight, borderBottom);
-				addChildAt(background, 0);
-				getProperties(background).isAbsolute = true;
-				this.background = background;
-				if( !needReflow ) {
-					background.width = flowCeil(calculatedWidth);
-					background.height = flowCeil(calculatedHeight);
-				}
-			}
+			if( background == null )
+				buildBackground(t);
 			background.tile = t;
 			background.tile = t;
 		} else {
 		} else {
 			if( background != null ) {
 			if( background != null ) {