Diff
diff --git a/cstyle/plugins/block/main.go b/cstyle/plugins/block/main.go
index 8ef7089..6a083e1 100644
--- a/cstyle/plugins/block/main.go
+++ b/cstyle/plugins/block/main.go
@@ -5,0 +6 @@ import (
+ "gui/utils"
@@ -13 +14 @@ func Init() cstyle.Plugin {
- Level: 0,
+ Level: 1,
@@ -17 +18 @@ func Init() cstyle.Plugin {
- // parent := s[n.Parent.Properties.Id]
+ parent := s[n.Parent.Properties.Id]
@@ -21,3 +22,6 @@ func Init() cstyle.Plugin {
- // if self.Style["width"] == "" {
- // self.Width, _ = utils.ConvertToPixels("100%", self.EM, parent.Width)
- // fmt.Println(self.Margin)
+ if n.Style["width"] == "" {
+ self.Width, _ = utils.ConvertToPixels("100%", self.EM, parent.Width)
+ }
+ m := utils.GetMP(*n, "margin")
+ self.Width -= (m.Right + m.Left)
+ self.Height -= (m.Top + m.Bottom)
@@ -25,10 +29,3 @@ func Init() cstyle.Plugin {
- // // self.Width -= (self.Padding.Right + self.Padding.Left)
- // // self.Height -= (self.Padding.Top + self.Padding.Bottom)
- // }
-
- // if self.X+self.Width+(self.Border.Width*2) > parent.Width {
- // self.Width = parent.Width
- // self.Width -= (self.Margin.Right + self.Margin.Left)
- // self.Width -= (self.Border.Width * 2)
- // self.Height -= (self.Margin.Top + self.Margin.Bottom)
- // }
+ p := utils.GetMP(*n, "padding")
+ self.Width += (p.Right + p.Left)
+ self.Height += (p.Top + p.Bottom)