mirror of
https://github.com/exyte/Macaw.git
synced 2024-11-13 13:14:20 +03:00
Update sources after generation
This commit is contained in:
parent
1e815c767f
commit
42bbe0c53f
@ -23,7 +23,7 @@ public class Color: Fill {
|
||||
public static let purple: Color = Color( val: 0x800080 )
|
||||
|
||||
public init(val: Int = 0) {
|
||||
self.val = val
|
||||
self.val = val
|
||||
}
|
||||
|
||||
// GENERATED
|
||||
|
@ -3,10 +3,19 @@ import RxSwift
|
||||
|
||||
public class Drawable {
|
||||
|
||||
public let visible: NSObject
|
||||
public let tag: [String]
|
||||
public let bounds: Rect?
|
||||
|
||||
public init(tag: [String] = []) {
|
||||
self.tag = tag
|
||||
public init(visible: NSObject = true, tag: [String] = [], bounds: Rect? = nil) {
|
||||
self.visible = visible
|
||||
self.tag = tag
|
||||
self.bounds = bounds
|
||||
}
|
||||
|
||||
// GENERATED
|
||||
public func mouse() -> Mouse {
|
||||
return Mouse(pos: Point(), onEnter: Signal(), onExit: Signal(), onWheel: Signal())
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,12 +11,12 @@ public class Font {
|
||||
public let strike: NSObject
|
||||
|
||||
public init(name: String = "Serif", size: Int = 12, bold: NSObject = false, italic: NSObject = false, underline: NSObject = false, strike: NSObject = false) {
|
||||
self.name = name
|
||||
self.size = size
|
||||
self.bold = bold
|
||||
self.italic = italic
|
||||
self.underline = underline
|
||||
self.strike = strike
|
||||
self.name = name
|
||||
self.size = size
|
||||
self.bold = bold
|
||||
self.italic = italic
|
||||
self.underline = underline
|
||||
self.strike = strike
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,12 +11,12 @@ public class LinearGradient: Fill {
|
||||
public let y2: Double
|
||||
|
||||
public init(userSpace: Bool = false, stops: [Stop] = [], x1: Double = 0, y1: Double = 0, x2: Double = 0, y2: Double = 0) {
|
||||
self.userSpace = userSpace
|
||||
self.stops = stops
|
||||
self.x1 = x1
|
||||
self.y1 = y1
|
||||
self.x2 = x2
|
||||
self.y2 = y2
|
||||
self.userSpace = userSpace
|
||||
self.stops = stops
|
||||
self.x1 = x1
|
||||
self.y1 = y1
|
||||
self.x2 = x2
|
||||
self.y2 = y2
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,8 +7,8 @@ public class Stop {
|
||||
public let color: Color
|
||||
|
||||
public init(offset: Double = 0, color: Color) {
|
||||
self.offset = offset
|
||||
self.color = color
|
||||
self.offset = offset
|
||||
self.color = color
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,11 +10,11 @@ public class Stroke {
|
||||
public let dashes: [Double]
|
||||
|
||||
public init(fill: Fill, width: Double = 1, cap: LineCap = .butt, join: LineJoin = .miter, dashes: [Double] = []) {
|
||||
self.fill = fill
|
||||
self.width = width
|
||||
self.cap = cap
|
||||
self.join = join
|
||||
self.dashes = dashes
|
||||
self.fill = fill
|
||||
self.width = width
|
||||
self.cap = cap
|
||||
self.join = join
|
||||
self.dashes = dashes
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,9 +8,9 @@ public class Arc: Locus {
|
||||
public let extent: Double
|
||||
|
||||
public init(ellipse: Ellipse, shift: Double = 0, extent: Double = 0) {
|
||||
self.ellipse = ellipse
|
||||
self.shift = shift
|
||||
self.extent = extent
|
||||
self.ellipse = ellipse
|
||||
self.shift = shift
|
||||
self.extent = extent
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,9 +8,9 @@ public class Circle: Locus {
|
||||
public let r: Double
|
||||
|
||||
public init(cx: Double = 0, cy: Double = 0, r: Double = 0) {
|
||||
self.cx = cx
|
||||
self.cy = cy
|
||||
self.r = r
|
||||
self.cx = cx
|
||||
self.cy = cy
|
||||
self.r = r
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,12 +11,12 @@ public class Cubic: PathSegment {
|
||||
public let y: Double
|
||||
|
||||
public init(x1: Double = 0, y1: Double = 0, x2: Double = 0, y2: Double = 0, x: Double = 0, y: Double = 0, absolute: Bool = false) {
|
||||
self.x1 = x1
|
||||
self.y1 = y1
|
||||
self.x2 = x2
|
||||
self.y2 = y2
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.x1 = x1
|
||||
self.y1 = y1
|
||||
self.x2 = x2
|
||||
self.y2 = y2
|
||||
self.x = x
|
||||
self.y = y
|
||||
super.init(
|
||||
absolute: absolute
|
||||
)
|
||||
|
@ -9,10 +9,10 @@ public class Ellipse: Locus {
|
||||
public let ry: Double
|
||||
|
||||
public init(cx: Double = 0, cy: Double = 0, rx: Double = 0, ry: Double = 0) {
|
||||
self.cx = cx
|
||||
self.cy = cy
|
||||
self.rx = rx
|
||||
self.ry = ry
|
||||
self.cx = cx
|
||||
self.cy = cy
|
||||
self.rx = rx
|
||||
self.ry = ry
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
|
@ -12,13 +12,13 @@ public class Elliptical: PathSegment {
|
||||
public let y: Double
|
||||
|
||||
public init(rx: Double = 0, ry: Double = 0, angle: Double = 0, largeArc: Bool = false, sweep: Bool = false, x: Double = 0, y: Double = 0, absolute: Bool = false) {
|
||||
self.rx = rx
|
||||
self.ry = ry
|
||||
self.angle = angle
|
||||
self.largeArc = largeArc
|
||||
self.sweep = sweep
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.rx = rx
|
||||
self.ry = ry
|
||||
self.angle = angle
|
||||
self.largeArc = largeArc
|
||||
self.sweep = sweep
|
||||
self.x = x
|
||||
self.y = y
|
||||
super.init(
|
||||
absolute: absolute
|
||||
)
|
||||
|
@ -6,7 +6,7 @@ public class HLine: PathSegment {
|
||||
public let x: Double
|
||||
|
||||
public init(x: Double = 0, absolute: Bool = false) {
|
||||
self.x = x
|
||||
self.x = x
|
||||
super.init(
|
||||
absolute: absolute
|
||||
)
|
||||
|
@ -9,10 +9,10 @@ public class Insets {
|
||||
public let left: Double
|
||||
|
||||
public init(top: Double = 0, right: Double = 0, bottom: Double = 0, left: Double = 0) {
|
||||
self.top = top
|
||||
self.right = right
|
||||
self.bottom = bottom
|
||||
self.left = left
|
||||
self.top = top
|
||||
self.right = right
|
||||
self.bottom = bottom
|
||||
self.left = left
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,10 +9,10 @@ public class Line: Locus {
|
||||
public let y2: Double
|
||||
|
||||
public init(x1: Double = 0, y1: Double = 0, x2: Double = 0, y2: Double = 0) {
|
||||
self.x1 = x1
|
||||
self.y1 = y1
|
||||
self.x2 = x2
|
||||
self.y2 = y2
|
||||
self.x1 = x1
|
||||
self.y1 = y1
|
||||
self.x2 = x2
|
||||
self.y2 = y2
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,8 +7,8 @@ public class Move: PathSegment {
|
||||
public let y: Double
|
||||
|
||||
public init(x: Double = 0, y: Double = 0, absolute: Bool = false) {
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.x = x
|
||||
self.y = y
|
||||
super.init(
|
||||
absolute: absolute
|
||||
)
|
||||
|
@ -7,8 +7,8 @@ public class PLine: PathSegment {
|
||||
public let y: Double
|
||||
|
||||
public init(x: Double = 0, y: Double = 0, absolute: Bool = false) {
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.x = x
|
||||
self.y = y
|
||||
super.init(
|
||||
absolute: absolute
|
||||
)
|
||||
|
@ -6,7 +6,7 @@ public class Path: Locus {
|
||||
public let segments: [PathSegment]
|
||||
|
||||
public init(segments: [PathSegment] = []) {
|
||||
self.segments = segments
|
||||
self.segments = segments
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ public class PathSegment {
|
||||
public let absolute: Bool
|
||||
|
||||
public init(absolute: Bool = false) {
|
||||
self.absolute = absolute
|
||||
self.absolute = absolute
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Foundation
|
||||
import RxSwift
|
||||
|
||||
public class Point: Locus {
|
||||
public class Point: Locus {
|
||||
|
||||
public let x: Double
|
||||
public let y: Double
|
||||
@ -11,10 +11,6 @@ public class Point: Locus {
|
||||
self.y = y
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
public class func zero() -> Point {
|
||||
return Point(x: 0.0, y: 0.0)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
public func add(point: Point) -> Point {
|
||||
@ -22,4 +18,9 @@ public class Point: Locus {
|
||||
x: self.x + point.x,
|
||||
y: self.y + point.y)
|
||||
}
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
public class func zero() -> Point {
|
||||
return Point(x: 0.0, y: 0.0)
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ public class Polygon: Locus {
|
||||
public let points: [Double]
|
||||
|
||||
public init(points: [Double] = []) {
|
||||
self.points = points
|
||||
self.points = points
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ public class Polyline: Locus {
|
||||
public let points: [Double]
|
||||
|
||||
public init(points: [Double] = []) {
|
||||
self.points = points
|
||||
self.points = points
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,10 +9,10 @@ public class Quadratic: PathSegment {
|
||||
public let y: Double
|
||||
|
||||
public init(x1: Double = 0, y1: Double = 0, x: Double = 0, y: Double = 0, absolute: Bool = false) {
|
||||
self.x1 = x1
|
||||
self.y1 = y1
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.x1 = x1
|
||||
self.y1 = y1
|
||||
self.x = x
|
||||
self.y = y
|
||||
super.init(
|
||||
absolute: absolute
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Foundation
|
||||
import RxSwift
|
||||
|
||||
public class Rect: Locus {
|
||||
public class Rect: Locus {
|
||||
|
||||
public let x: Double
|
||||
public let y: Double
|
||||
@ -24,10 +24,6 @@ public class Rect: Locus {
|
||||
return false
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
class func zero() -> Rect {
|
||||
return Rect(x: 0.0, y: 0.0, w: 0.0, h: 0.0)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
public func union(rect: Rect) -> Rect {
|
||||
@ -38,6 +34,11 @@ public class Rect: Locus {
|
||||
h: max(self.y + self.h, rect.y + rect.h) - min(self.y, rect.y))
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
class func zero() -> Rect {
|
||||
return Rect(x: 0.0, y: 0.0, w: 0.0, h: 0.0)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
public func move(offset: Point) -> Rect {
|
||||
return Rect(
|
||||
@ -46,4 +47,4 @@ public class Rect: Locus {
|
||||
w: self.w,
|
||||
h: self.h)
|
||||
}
|
||||
}
|
||||
}
|
@ -8,9 +8,9 @@ public class RoundRect: Locus {
|
||||
public let ry: Double
|
||||
|
||||
public init(rect: Rect, rx: Double = 0, ry: Double = 0) {
|
||||
self.rect = rect
|
||||
self.rx = rx
|
||||
self.ry = ry
|
||||
self.rect = rect
|
||||
self.rx = rx
|
||||
self.ry = ry
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,10 +9,10 @@ public class SCubic: PathSegment {
|
||||
public let y: Double
|
||||
|
||||
public init(x2: Double = 0, y2: Double = 0, x: Double = 0, y: Double = 0, absolute: Bool = false) {
|
||||
self.x2 = x2
|
||||
self.y2 = y2
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.x2 = x2
|
||||
self.y2 = y2
|
||||
self.x = x
|
||||
self.y = y
|
||||
super.init(
|
||||
absolute: absolute
|
||||
)
|
||||
|
@ -7,8 +7,8 @@ public class SQuadratic: PathSegment {
|
||||
public let y: Double
|
||||
|
||||
public init(x: Double = 0, y: Double = 0, absolute: Bool = false) {
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.x = x
|
||||
self.y = y
|
||||
super.init(
|
||||
absolute: absolute
|
||||
)
|
||||
|
@ -7,8 +7,8 @@ public class Size {
|
||||
public let h: Double
|
||||
|
||||
public init(w: Double = 0, h: Double = 0) {
|
||||
self.w = w
|
||||
self.h = h
|
||||
self.w = w
|
||||
self.h = h
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,18 +11,18 @@ public final class Transform {
|
||||
public let dy: Double
|
||||
|
||||
public init(m11: Double = 1, m12: Double = 0, m21: Double = 0, m22: Double = 1, dx: Double = 0, dy: Double = 0) {
|
||||
self.m11 = m11
|
||||
self.m12 = m12
|
||||
self.m21 = m21
|
||||
self.m22 = m22
|
||||
self.dx = dx
|
||||
self.dy = dy
|
||||
self.m11 = m11
|
||||
self.m12 = m12
|
||||
self.m21 = m21
|
||||
self.m22 = m22
|
||||
self.dx = dx
|
||||
self.dy = dy
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
public func move(mx: Double, my: Double) -> Transform {
|
||||
return Transform(m11: m11, m12: m12, m21: m21, m22: m22,
|
||||
dx: mx * m11 + my * m21 + dx, dy: mx * m12 + my * m22 + dy)
|
||||
return Transform(m11: m11, m12: m12, m21: m21, m22: m22,
|
||||
dx: mx * m11 + my * m21 + dx, dy: mx * m12 + my * m22 + dy)
|
||||
}
|
||||
// GENERATED NOT
|
||||
public func scale(sx: Double, sy: Double) -> Transform {
|
||||
@ -31,14 +31,14 @@ public final class Transform {
|
||||
// GENERATED NOT
|
||||
public func shear(shx: Double, shy: Double) -> Transform {
|
||||
return Transform(m11: m11 + m21 * shy, m12: m12 + m22 * shy,
|
||||
m21: m11 * shx + m21, m22: m12 * shx + m22, dx: dx, dy: dy)
|
||||
m21: m11 * shx + m21, m22: m12 * shx + m22, dx: dx, dy: dy)
|
||||
}
|
||||
// GENERATED NOT
|
||||
public func rotate(angle: Double) -> Transform {
|
||||
let asin = sin(angle); let acos = cos(angle)
|
||||
return Transform(m11: acos * m11 + asin * m21, m12: acos * m12 + asin * m22,
|
||||
m21: -asin * m11 + acos * m21, m22: -asin * m12 + acos * m22, dx: dx, dy: dy)
|
||||
}
|
||||
let asin = sin(angle); let acos = cos(angle)
|
||||
return Transform(m11: acos * m11 + asin * m21, m12: acos * m12 + asin * m22,
|
||||
m21: -asin * m11 + acos * m21, m22: -asin * m12 + acos * m22, dx: dx, dy: dy)
|
||||
}
|
||||
|
||||
// GENERATED
|
||||
public class func move(mx: Double, my: Double) -> Transform {
|
||||
@ -57,7 +57,7 @@ public final class Transform {
|
||||
|
||||
// GENERATED NOT
|
||||
public class func rotate(angle: Double) -> Transform {
|
||||
let asin = sin(angle); let acos = cos(angle)
|
||||
let asin = sin(angle); let acos = cos(angle)
|
||||
return Transform(m11: acos, m12: asin, m21: -asin, m22: acos)
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ public class VLine: PathSegment {
|
||||
public let y: Double
|
||||
|
||||
public init(y: Double = 0, absolute: Bool = false) {
|
||||
self.y = y
|
||||
self.y = y
|
||||
super.init(
|
||||
absolute: absolute
|
||||
)
|
||||
|
@ -34,11 +34,11 @@ public class Mouse {
|
||||
}
|
||||
|
||||
public init(hover: Bool = false, pos: Point, onEnter: Signal, onExit: Signal, onWheel: Signal) {
|
||||
self.hoverVar = Variable<Bool>(hover)
|
||||
self.posVar = Variable<Point>(pos)
|
||||
self.onEnterVar = Variable<Signal>(onEnter)
|
||||
self.onExitVar = Variable<Signal>(onExit)
|
||||
self.onWheelVar = Variable<Signal>(onWheel)
|
||||
self.hoverVar = Variable<Bool>(hover)
|
||||
self.posVar = Variable<Point>(pos)
|
||||
self.onEnterVar = Variable<Signal>(onEnter)
|
||||
self.onExitVar = Variable<Signal>(onExit)
|
||||
self.onWheelVar = Variable<Signal>(onWheel)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
|
@ -34,11 +34,11 @@ public class MouseButton {
|
||||
}
|
||||
|
||||
public init(pressed: Bool = false, onPress: Signal, onRelease: Signal, onClick: Signal, onDoubleClick: Signal) {
|
||||
self.pressedVar = Variable<Bool>(pressed)
|
||||
self.onPressVar = Variable<Signal>(onPress)
|
||||
self.onReleaseVar = Variable<Signal>(onRelease)
|
||||
self.onClickVar = Variable<Signal>(onClick)
|
||||
self.onDoubleClickVar = Variable<Signal>(onDoubleClick)
|
||||
self.pressedVar = Variable<Bool>(pressed)
|
||||
self.onPressVar = Variable<Signal>(onPress)
|
||||
self.onReleaseVar = Variable<Signal>(onRelease)
|
||||
self.onClickVar = Variable<Signal>(onClick)
|
||||
self.onDoubleClickVar = Variable<Signal>(onDoubleClick)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,30 +3,32 @@ import RxSwift
|
||||
|
||||
public class Group: Node {
|
||||
|
||||
public var contentsVar: Variable<[Node]>
|
||||
public var contentsVar: ObservableArray<Node>
|
||||
|
||||
public init(contents: [Node] = [], pos: Transform = Transform(), opaque: NSObject = true, visible: NSObject = true, clip: Locus? = nil, tag: [String] = []) {
|
||||
self.contentsVar = Variable<[Node]>(contents)
|
||||
public init(contents: [Node] = [], pos: Transform = Transform(), opaque: NSObject = true, opacity: Double = 1, clip: Locus? = nil, visible: NSObject = true, tag: [String] = [], bounds: Rect? = nil) {
|
||||
self.contentsVar = ObservableArray<Node>(array: contents)
|
||||
super.init(
|
||||
pos: pos,
|
||||
opaque: opaque,
|
||||
visible: visible,
|
||||
opacity: opacity,
|
||||
clip: clip,
|
||||
tag: tag
|
||||
visible: visible,
|
||||
tag: tag,
|
||||
bounds: bounds
|
||||
)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
override public func bounds() -> Rect? {
|
||||
guard let firstPos = contentsVar.value.first?.pos else {
|
||||
guard let firstPos = contentsVar.first?.pos else {
|
||||
return .None
|
||||
}
|
||||
|
||||
guard var union = contentsVar.value.first?.bounds()?.applyTransform(firstPos) else {
|
||||
guard var union = contentsVar.first?.bounds()?.applyTransform(firstPos) else {
|
||||
return .None
|
||||
}
|
||||
|
||||
contentsVar.value.forEach { node in
|
||||
contentsVar.forEach { node in
|
||||
guard let nodeBounds = node.bounds() else {
|
||||
return
|
||||
}
|
||||
@ -36,4 +38,4 @@ public class Group: Node {
|
||||
|
||||
return union // .applyTransform(pos)
|
||||
}
|
||||
}
|
||||
}
|
@ -39,19 +39,21 @@ public class Image: Node {
|
||||
set(val) { hVar.value = val }
|
||||
}
|
||||
|
||||
public init(src: String, xAlign: Align = .min, yAlign: Align = .min, aspectRatio: AspectRatio = .none, w: Int = 0, h: Int = 0, pos: Transform = Transform(), opaque: NSObject = true, visible: NSObject = true, clip: Locus? = nil, tag: [String] = []) {
|
||||
self.srcVar = Variable<String>(src)
|
||||
self.xAlignVar = Variable<Align>(xAlign)
|
||||
self.yAlignVar = Variable<Align>(yAlign)
|
||||
self.aspectRatioVar = Variable<AspectRatio>(aspectRatio)
|
||||
self.wVar = Variable<Int>(w)
|
||||
self.hVar = Variable<Int>(h)
|
||||
public init(src: String, xAlign: Align = .min, yAlign: Align = .min, aspectRatio: AspectRatio = .none, w: Int = 0, h: Int = 0, pos: Transform = Transform(), opaque: NSObject = true, opacity: Double = 1, clip: Locus? = nil, visible: NSObject = true, tag: [String] = [], bounds: Rect? = nil) {
|
||||
self.srcVar = Variable<String>(src)
|
||||
self.xAlignVar = Variable<Align>(xAlign)
|
||||
self.yAlignVar = Variable<Align>(yAlign)
|
||||
self.aspectRatioVar = Variable<AspectRatio>(aspectRatio)
|
||||
self.wVar = Variable<Int>(w)
|
||||
self.hVar = Variable<Int>(h)
|
||||
super.init(
|
||||
pos: pos,
|
||||
opaque: opaque,
|
||||
visible: visible,
|
||||
opacity: opacity,
|
||||
clip: clip,
|
||||
tag: tag
|
||||
visible: visible,
|
||||
tag: tag,
|
||||
bounds: bounds
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -15,10 +15,10 @@ public class Node: Drawable {
|
||||
set(val) { opaqueVar.value = val }
|
||||
}
|
||||
|
||||
public let visibleVar: Variable<NSObject>
|
||||
public var visible: NSObject {
|
||||
get { return visibleVar.value }
|
||||
set(val) { visibleVar.value = val }
|
||||
public let opacityVar: Variable<Double>
|
||||
public var opacity: Double {
|
||||
get { return opacityVar.value }
|
||||
set(val) { opacityVar.value = val }
|
||||
}
|
||||
|
||||
public let clipVar: Variable<Locus?>
|
||||
@ -27,23 +27,25 @@ public class Node: Drawable {
|
||||
set(val) { clipVar.value = val }
|
||||
}
|
||||
|
||||
public init(pos: Transform, opaque: NSObject = true, visible: NSObject = true, clip: Locus? = nil, tag: [String] = []) {
|
||||
public init(pos: Transform, opaque: NSObject = true, opacity: Double = 1, clip: Locus? = nil, visible: NSObject = true, tag: [String] = [], bounds: Rect? = nil) {
|
||||
self.posVar = Variable<Transform>(pos)
|
||||
self.opaqueVar = Variable<NSObject>(opaque)
|
||||
self.visibleVar = Variable<NSObject>(visible)
|
||||
self.opacityVar = Variable<Double>(opacity)
|
||||
self.clipVar = Variable<Locus?>(clip)
|
||||
super.init(
|
||||
tag: tag
|
||||
visible: visible,
|
||||
tag: tag,
|
||||
bounds: bounds
|
||||
)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
public func mouse() -> Mouse {
|
||||
return Mouse(pos: Point(), onEnter: Signal(), onExit: Signal(), onWheel: Signal())
|
||||
}
|
||||
// GENERATED NOT
|
||||
public func bounds() -> Rect? {
|
||||
return Rect()
|
||||
}
|
||||
|
||||
}
|
||||
// GENERATED NOT
|
||||
public override func mouse() -> Mouse {
|
||||
return Mouse(pos: Point(), onEnter: Signal(), onExit: Signal(), onWheel: Signal())
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
import Foundation
|
||||
import RxSwift
|
||||
|
||||
public class Shape: Node {
|
||||
public class Shape: Node {
|
||||
|
||||
public let formVar: Variable<Locus>
|
||||
public var form: Locus {
|
||||
@ -21,19 +21,22 @@ public class Shape: Node {
|
||||
set(val) { strokeVar.value = val }
|
||||
}
|
||||
|
||||
public init(form: Locus, fill: Fill? = nil, stroke: Stroke? = nil, pos: Transform = Transform(), opaque: NSObject = true, visible: NSObject = true, clip: Locus? = nil, tag: [String] = []) {
|
||||
public init(form: Locus, fill: Fill? = nil, stroke: Stroke? = nil, pos: Transform = Transform(), opaque: NSObject = true, opacity: Double = 1, clip: Locus? = nil, visible: NSObject = true, tag: [String] = [], bounds: Rect? = nil) {
|
||||
self.formVar = Variable<Locus>(form)
|
||||
self.fillVar = Variable<Fill?>(fill)
|
||||
self.strokeVar = Variable<Stroke?>(stroke)
|
||||
super.init(
|
||||
pos: pos,
|
||||
opaque: opaque,
|
||||
visible: visible,
|
||||
opacity: opacity,
|
||||
clip: clip,
|
||||
tag: tag
|
||||
visible: visible,
|
||||
tag: tag,
|
||||
bounds: bounds
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
// GENERATED NOT
|
||||
override public func bounds() -> Rect? {
|
||||
|
||||
@ -61,4 +64,4 @@ public class Shape: Node {
|
||||
|
||||
return form.bounds()
|
||||
}
|
||||
}
|
||||
}
|
@ -33,18 +33,20 @@ public class Text: Node {
|
||||
set(val) { baselineVar.value = val }
|
||||
}
|
||||
|
||||
public init(text: String, font: Font, fill: Fill, align: Align = .min, baseline: Baseline = .top, pos: Transform = Transform(), opaque: NSObject = true, visible: NSObject = true, clip: Locus? = nil, tag: [String] = []) {
|
||||
self.textVar = Variable<String>(text)
|
||||
self.fontVar = Variable<Font>(font)
|
||||
self.fillVar = Variable<Fill>(fill)
|
||||
self.alignVar = Variable<Align>(align)
|
||||
self.baselineVar = Variable<Baseline>(baseline)
|
||||
public init(text: String, font: Font, fill: Fill, align: Align = .min, baseline: Baseline = .top, pos: Transform = Transform(), opaque: NSObject = true, opacity: Double = 1, clip: Locus? = nil, visible: NSObject = true, tag: [String] = [], bounds: Rect? = nil) {
|
||||
self.textVar = Variable<String>(text)
|
||||
self.fontVar = Variable<Font>(font)
|
||||
self.fillVar = Variable<Fill>(fill)
|
||||
self.alignVar = Variable<Align>(align)
|
||||
self.baselineVar = Variable<Baseline>(baseline)
|
||||
super.init(
|
||||
pos: pos,
|
||||
opaque: opaque,
|
||||
visible: visible,
|
||||
opacity: opacity,
|
||||
clip: clip,
|
||||
tag: tag
|
||||
visible: visible,
|
||||
tag: tag,
|
||||
bounds: bounds
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,8 @@ class GroupRenderer: NodeRenderer {
|
||||
func onGroupChange(new: [Node]) {
|
||||
ctx.view?.setNeedsDisplay()
|
||||
}
|
||||
group.contentsVar.asObservable().subscribeNext { new in
|
||||
|
||||
group.contentsVar.rx_elements().asObservable().subscribeNext { new in
|
||||
onGroupChange(new)
|
||||
}.addDisposableTo(disposeBag)
|
||||
}
|
||||
@ -35,7 +36,7 @@ class GroupRenderer: NodeRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
let staticContents = group.contentsVar.value.filter { !$0.animating }
|
||||
let staticContents = group.contentsVar.filter { !$0.animating }
|
||||
|
||||
let contentRenderers = staticContents.map { RenderUtils.createNodeRenderer($0, context: ctx) }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user