浏览代码

changed flow behavior wrt background border width/height:
does not count as an extra padding anymore, use -D flow_border to keep previous behavior

Nicolas Cannasse 5 年之前
父节点
当前提交
6d0b08d479
共有 1 个文件被更改,包括 6 次插入4 次删除
  1. 6 4
      h2d/Flow.hx

+ 6 - 4
h2d/Flow.hx

@@ -365,12 +365,12 @@ class Flow extends Object {
 
 	function get_innerWidth() {
 		if( needReflow ) reflow();
-		return Math.ceil(calculatedWidth) - (paddingLeft + paddingRight + borderWidth * 2);
+		return Math.ceil(calculatedWidth) - (paddingLeft + paddingRight #if flow_border + borderWidth * 2 #end);
 	}
 
 	function get_innerHeight() {
 		if( needReflow ) reflow();
-		return Math.ceil(calculatedHeight) - (paddingTop + paddingBottom + borderHeight * 2);
+		return Math.ceil(calculatedHeight) - (paddingTop + paddingBottom #if flow_border + borderHeight * 2 #end);
 	}
 
 	function set_paddingLeft(v) {
@@ -654,7 +654,7 @@ class Flow extends Object {
 		if( borderWidth == v )
 			return v;
 		if( background != null ) background.borderWidth = v;
-		needReflow = true;
+		#if flow_border needReflow = true; #end
 		return borderWidth = v;
 	}
 
@@ -662,7 +662,7 @@ class Flow extends Object {
 		if( borderHeight == v )
 			return v;
 		if( background != null ) background.borderHeight = v;
-		needReflow = true;
+		#if flow_border needReflow = true; #end
 		return borderHeight = v;
 	}
 
@@ -681,6 +681,8 @@ class Flow extends Object {
 				isConstraint = false;
 			}
 		}
+		var borderWidth = #if flow_border borderWidth #else 0 #end;
+		var borderHeight = #if flow_border borderHeight #else 0 #end;
 
 		var isConstraintWidth = realMaxWidth >= 0;
 		var isConstraintHeight = realMaxHeight >= 0;