diff --git a/cstyle/plugins/inline/main.go b/cstyle/plugins/inline/main.go
index 84e4958..90282bb 100644
--- a/cstyle/plugins/inline/main.go
+++ b/cstyle/plugins/inline/main.go
@@ -14 +14 @@ func Init() cstyle.Plugin {
- Handler: func(n *element.Node) {
+ Handler: func(n element.Node) element.Node {
@@ -36,0 +37 @@ func Init() cstyle.Plugin {
+ return n
package inline
import (
"gui/cstyle"
"gui/element"
)
func Init() cstyle.Plugin {
return cstyle.Plugin{
Styles: map[string]string{
"display": "inline",
},
Level: 1,
Handler: func(n *element.Node) {
copyOfX := n.Properties.X
for i, v := range n.Parent.Children {
if v.Properties.Id == n.Properties.Id {
if n.Properties.X+n.Properties.Width-2 > n.Parent.Properties.Width+copyOfX && i > 0 {
n.Properties.Y += float32(n.Parent.Children[i-1].Properties.Height)
n.Properties.X = copyOfX
}
if i > 0 {
if n.Parent.Children[i-1].Style["display"] == "inline" {
if n.Parent.Children[i-1].Properties.Text.X+n.Properties.Text.Width < int(n.Parent.Children[i-1].Properties.Width) {
n.Properties.Y -= float32(n.Parent.Children[i-1].Properties.Text.LineHeight)
n.Properties.X += float32(n.Parent.Children[i-1].Properties.Text.X)
}
}
}
break
} else if v.Style["display"] == "inline" {
n.Properties.X += v.Properties.Width
} else {
n.Properties.X = copyOfX
}
}
},
}
}