Commit 882bc9c
Add ClipPath
Changed files (2)
Diff
@@ -32,7 +32,25 @@ class BoxLayout : Component { this.orientation = orientation; } - void set_max_size (Component component) {+ void set_size_limits (Component component) {+ string? min_width = style.get_css_property ("min-width");+ if (min_width != null) {+ double w = SvgFile.parse_number (min_width);+ + if (component.width < w) {+ component.width = w;+ }+ }++ string? min_height = style.get_css_property ("min-height");+ if (min_height != null) {+ double h = SvgFile.parse_number (min_height);+ + if (component.height < h) {+ component.height = h;+ }+ }+ string? max_width = style.get_css_property ("max-width"); if (max_width != null) { double w = SvgFile.parse_number (max_width);@@ -49,7 +67,7 @@ class BoxLayout : Component { if (component.height > h) { component.height = h; }- } + } } public override void layout () {@@ -61,8 +79,9 @@ class BoxLayout : Component { component.y = child_y; component.layout (); component.apply_padding ();- set_max_size (component);+ set_size_limits (component); + print (@"$(component), $(component.style)\n"); if (orientation == BoxOrientation.HORIZONTAL) { child_x += component.padded_width; new file mode 100644@@ -0,0 +1,38 @@+/*+ Copyright (C) 2016 Johan Mattsson++ This library is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version.++ This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details.+*/++using Cairo;++namespace SvgBird {++public class ClipPath : GLib.Object {+ Layer layer = new Layer ();+ + public string id {+ get {+ return layer.id;+ }+ }+ + public ClipPath (Layer layer) {+ this.layer = layer;+ }+ + public void apply (Context cr) {+ layer.draw_outline (cr);+ cr.clip ();+ }+}++}