From ea87545ee8f0536db05f75e83710076f294a2663 Mon Sep 17 00:00:00 2001 From: Shallowmallow Date: Sun, 5 May 2024 11:45:57 +0200 Subject: [PATCH 1/3] Adding layout-rows for horizontal-grid --- haxe/ui/layouts/HorizontalGridLayout.hx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/haxe/ui/layouts/HorizontalGridLayout.hx b/haxe/ui/layouts/HorizontalGridLayout.hx index 28197de06..9281cb561 100644 --- a/haxe/ui/layouts/HorizontalGridLayout.hx +++ b/haxe/ui/layouts/HorizontalGridLayout.hx @@ -24,6 +24,14 @@ class HorizontalGridLayout extends Layout { super(); } + public override function applyProperties(props:Map) { + if (props != null) { + if (props.exists("rows") && props.get("rows") != null) { + this.rows = props.get("rows"); + } + } + } + private override function get_usableSize():Size { var size:Size = super.get_usableSize(); var columnWidths:Array = calcColumnWidths(size, false); From fb92e9b91785728d7ec4a55ce0f578a46fb4a509 Mon Sep 17 00:00:00 2001 From: Shallowmallow Date: Mon, 6 May 2024 10:47:17 +0200 Subject: [PATCH 2/3] canvas: Adding Begin and Close path --- haxe/ui/backend/ComponentGraphicsBase.hx | 13 ++++++++++++- haxe/ui/components/Canvas.hx | 4 ++++ haxe/ui/graphics/DrawCommand.hx | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/haxe/ui/backend/ComponentGraphicsBase.hx b/haxe/ui/backend/ComponentGraphicsBase.hx index 24466482b..f63af8bc1 100644 --- a/haxe/ui/backend/ComponentGraphicsBase.hx +++ b/haxe/ui/backend/ComponentGraphicsBase.hx @@ -63,6 +63,14 @@ class ComponentGraphicsBase { public function image(resource:Variant, x:Null = null, y:Null = null, width:Null = null, height:Null = null) { addDrawCommand(Image(resource, x, y, width, height)); } + + public function beginPath() { + addDrawCommand(BeginPath); + } + + public function closePath() { + addDrawCommand(ClosePath); + } private function addDrawCommand(command:DrawCommand) { _drawCommands.push(command); @@ -106,7 +114,10 @@ class ComponentGraphicsBase { rectangle(x, y, width, height); case Image(resource, x, y, width, height): image(resource, x, y, width, height); - + case BeginPath: + beginPath(); + case ClosePath: + closePath(); } } } diff --git a/haxe/ui/components/Canvas.hx b/haxe/ui/components/Canvas.hx index 93685d2b6..12effda80 100644 --- a/haxe/ui/components/Canvas.hx +++ b/haxe/ui/components/Canvas.hx @@ -89,6 +89,10 @@ private class DataSourceBehaviour extends DataBehaviour { var y:Null = Std.parseFloat(item.y); var radius:Null = Std.parseFloat(item.radius); g.circle(x, y, radius); + case "beginPath" | "begin-path": + g.beginPath(); + case "closePath" | "close-path": + g.closePath(); case _: trace("unrecognised draw command: " + item); } diff --git a/haxe/ui/graphics/DrawCommand.hx b/haxe/ui/graphics/DrawCommand.hx index 4c26df861..21064f787 100644 --- a/haxe/ui/graphics/DrawCommand.hx +++ b/haxe/ui/graphics/DrawCommand.hx @@ -17,4 +17,6 @@ enum DrawCommand { CubicCurveTo(controlX1:Float, controlY1:Float, controlX2:Float, controlY2:Float, anchorX:Float, anchorY:Float); Rectangle(x:Float, y:Float, width:Float, height:Float); Image(resource:Variant, x:Float, y:Float, width:Float, height:Float); + BeginPath; + ClosePath; } From 0f00b46c582d9c111e9af0960ab61b531b74d47e Mon Sep 17 00:00:00 2001 From: Shallowmallow Date: Mon, 6 May 2024 10:48:08 +0200 Subject: [PATCH 3/3] canvas: adding curveTo and cubicCurveTo from xml --- haxe/ui/components/Canvas.hx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/haxe/ui/components/Canvas.hx b/haxe/ui/components/Canvas.hx index 12effda80..400c6ad0b 100644 --- a/haxe/ui/components/Canvas.hx +++ b/haxe/ui/components/Canvas.hx @@ -62,6 +62,20 @@ private class DataSourceBehaviour extends DataBehaviour { var x:Null = (item.x != null) ? Std.parseFloat(item.x) : 0; var y:Null = (item.y != null) ? Std.parseFloat(item.y) : 0; g.lineTo(x, y); + case "curveTo" | "curve-to": + var controlX:Null = (item.controlX != null) ? Std.parseFloat(item.controlX) : 0; + var controlY:Null = (item.controlY != null) ? Std.parseFloat(item.controlY) : 0; + var anchorX:Null = (item.anchorX != null) ? Std.parseFloat(item.anchorX) : 0; + var anchorY:Null = (item.anchorY != null) ? Std.parseFloat(item.anchorY) : 0; + g.curveTo(controlX, controlY, anchorX, anchorY); + case "cubicCurveTo" | "cubic-curve-to": + var controlX:Null = (item.controlX != null) ? Std.parseFloat(item.controlX) : 0; + var controlY:Null = (item.controlY != null) ? Std.parseFloat(item.controlY) : 0; + var controlX2:Null = (item.controlX2 != null) ? Std.parseFloat(item.controlX2) : 0; + var controlY2:Null = (item.controlY2 != null) ? Std.parseFloat(item.controlY2) : 0; + var anchorX:Null = (item.anchorX != null) ? Std.parseFloat(item.anchorX) : 0; + var anchorY:Null = (item.anchorY != null) ? Std.parseFloat(item.anchorY) : 0; + g.cubicCurveTo(controlX, controlY, controlX2, controlY2, anchorX, anchorY); case "strokeStyle" | "stroke-style": var color:String = item.color; var thickness:Null = (item.thickness != null) ? Std.parseFloat(item.thickness) : 1;