1
1
mirror of https://github.com/exyte/Macaw.git synced 2024-09-21 01:47:44 +03:00
Macaw/Source/svg/SVGCanvas.swift
2018-06-25 16:33:05 +07:00

32 lines
644 B
Swift

//
// SVGCanvas.swift
// Macaw
//
// Created by Yuri Strot on 4/11/18.
//
class SVGCanvas: Group {
let layout: NodeLayout
public init(layout: NodeLayout, contents: [Node] = []) {
self.layout = layout
super.init(contents: contents)
}
public func layout(size: Size) -> Size {
let size = layout.computeSize(parent: size)
layout.layout(node: self, in: size)
return size
}
override var bounds: Rect? {
let size = layout.computeSize(parent: .zero)
if size.w == 0 || size.h == 0 {
return .none
}
return size.rect(at: .origin)
}
}