mirror of
https://github.com/exyte/Macaw.git
synced 2024-09-11 05:05:23 +03:00
Clean up model source code and avoid pod warnings
This commit is contained in:
parent
bc1220adde
commit
86c1df9964
@ -196,7 +196,6 @@
|
||||
A753C9E11F3DB18A006615A4 /* Frameworks */,
|
||||
A753C9E21F3DB18A006615A4 /* Resources */,
|
||||
D4AD26F62FE37F7476EC4BCA /* [CP] Embed Pods Frameworks */,
|
||||
3AE877354B4133CFC7CAF0DD /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@ -260,28 +259,16 @@
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-Example-macOS-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
3AE877354B4133CFC7CAF0DD /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example-macOS/Pods-Example-macOS-resources.sh\"\n";
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
D4AD26F62FE37F7476EC4BCA /* [CP] Embed Pods Frameworks */ = {
|
||||
@ -290,9 +277,14 @@
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${SRCROOT}/Pods/Target Support Files/Pods-Example-macOS/Pods-Example-macOS-frameworks.sh",
|
||||
"${BUILT_PRODUCTS_DIR}/Macaw/Macaw.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/SWXMLHash/SWXMLHash.framework",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Macaw.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SWXMLHash.framework",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
@ -1,5 +1,6 @@
|
||||
platform :osx, '10.12'
|
||||
use_frameworks!
|
||||
|
||||
target 'Example-macOS' do
|
||||
pod 'Macaw', :path => '../'
|
||||
end
|
||||
end
|
||||
|
@ -451,7 +451,6 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = B1435E8977BA0B9A49C4E399 /* Pods-Example.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
@ -471,7 +470,6 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 131DDFA4A9D164CC4B64C3E8 /* Pods-Example.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
|
@ -1,6 +1,6 @@
|
||||
platform :ios, '9.0'
|
||||
use_frameworks!
|
||||
|
||||
target 'Example' do
|
||||
pod 'Macaw', :path => '../'
|
||||
end
|
||||
|
||||
|
@ -1,64 +1,47 @@
|
||||
open class AspectRatio {
|
||||
|
||||
public static let none: AspectRatio = NoneAspectRatio()
|
||||
public static let none: AspectRatio = AspectRatio()
|
||||
public static let meet: AspectRatio = MeetAspectRatio()
|
||||
public static let slice: AspectRatio = SliceAspectRatio()
|
||||
|
||||
open func fit(size: Size, into sizeToFitIn: Size) -> Size {
|
||||
return Size(w: sizeToFitIn.w, h: sizeToFitIn.h)
|
||||
}
|
||||
|
||||
open func fit(rect: Rect, into rectToFitIn: Rect) -> Size {
|
||||
return Size(w: 0, h: 0)
|
||||
return fit(size: rect.size(), into: rectToFitIn.size())
|
||||
}
|
||||
|
||||
open func fit(size: Size, into rectToFitIn: Rect) -> Size {
|
||||
return fit(rect: Rect(x: 0, y: 0, w: size.w, h: size.h), into: rectToFitIn)
|
||||
return fit(size: size, into: rectToFitIn.size())
|
||||
}
|
||||
|
||||
open func fit(size: Size, into sizeToFitIn: Size) -> Size {
|
||||
return fit(size: size, into: Rect(x: 0, y: 0, w: sizeToFitIn.w, h: sizeToFitIn.h))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class NoneAspectRatio : AspectRatio {
|
||||
|
||||
override func fit(rect: Rect, into rectToFitIn: Rect) -> Size {
|
||||
return Size(w: rectToFitIn.w, h: rectToFitIn.h)
|
||||
}
|
||||
}
|
||||
|
||||
private class MeetAspectRatio : AspectRatio {
|
||||
|
||||
override func fit(rect: Rect, into rectToFitIn: Rect) -> Size {
|
||||
let widthRatio = rectToFitIn.w / rect.w
|
||||
let heightRatio = rectToFitIn.h / rect.h
|
||||
|
||||
var newWidth = rectToFitIn.w
|
||||
var newHeight = rectToFitIn.h
|
||||
override func fit(size: Size, into sizeToFitIn: Size) -> Size {
|
||||
let widthRatio = sizeToFitIn.w / size.w
|
||||
let heightRatio = sizeToFitIn.h / size.h
|
||||
|
||||
if heightRatio < widthRatio {
|
||||
newWidth = rect.w * heightRatio
|
||||
return Size(w: size.w * heightRatio, h: sizeToFitIn.h)
|
||||
} else {
|
||||
return Size(w: sizeToFitIn.w, h: size.h * widthRatio)
|
||||
}
|
||||
else {
|
||||
newHeight = rect.h * widthRatio
|
||||
}
|
||||
return Size(w: newWidth, h: newHeight)
|
||||
}
|
||||
}
|
||||
|
||||
private class SliceAspectRatio : AspectRatio {
|
||||
|
||||
override func fit(rect: Rect, into rectToFitIn: Rect) -> Size {
|
||||
let widthRatio = rectToFitIn.w / rect.w
|
||||
let heightRatio = rectToFitIn.h / rect.h
|
||||
|
||||
var newWidth = rectToFitIn.w
|
||||
var newHeight = rectToFitIn.h
|
||||
override func fit(size: Size, into sizeToFitIn: Size) -> Size {
|
||||
let widthRatio = sizeToFitIn.w / size.w
|
||||
let heightRatio = sizeToFitIn.h / size.h
|
||||
|
||||
if heightRatio > widthRatio {
|
||||
newWidth = rect.w * heightRatio
|
||||
return Size(w: size.w * heightRatio, h: sizeToFitIn.h)
|
||||
} else {
|
||||
return Size(w: sizeToFitIn.w, h: size.h * widthRatio)
|
||||
}
|
||||
else {
|
||||
newHeight = rect.h * widthRatio
|
||||
}
|
||||
return Size(w: newWidth, h: newHeight)
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
open class Color: Fill, Equatable {
|
||||
|
||||
open let val: Int
|
||||
@ -26,32 +24,26 @@ open class Color: Fill, Equatable {
|
||||
self.val = val
|
||||
}
|
||||
|
||||
// GENERATED
|
||||
open func r() -> Int {
|
||||
return ( ( val >> 16 ) & 0xff )
|
||||
}
|
||||
|
||||
// GENERATED
|
||||
open func g() -> Int {
|
||||
return ( ( val >> 8 ) & 0xff )
|
||||
}
|
||||
|
||||
// GENERATED
|
||||
open func b() -> Int {
|
||||
return ( val & 0xff )
|
||||
}
|
||||
|
||||
// GENERATED
|
||||
open func a() -> Int {
|
||||
return ( 255 - ( ( val >> 24 ) & 0xff ) )
|
||||
}
|
||||
|
||||
// GENERATED
|
||||
public func with(a: Double) -> Color {
|
||||
return Color.rgba(r: r(), g: g(), b: b(), a: a)
|
||||
}
|
||||
|
||||
// GENERATED
|
||||
open class func rgbt(r: Int, g: Int, b: Int, t: Int) -> Color {
|
||||
let x = ( ( t & 0xff ) << 24 )
|
||||
let y = ( ( r & 0xff ) << 16 )
|
||||
@ -60,12 +52,10 @@ open class Color: Fill, Equatable {
|
||||
return Color( val: ( ( ( x | y ) | z ) | q ) )
|
||||
}
|
||||
|
||||
// GENERATED
|
||||
open class func rgba(r: Int, g: Int, b: Int, a: Double) -> Color {
|
||||
return rgbt( r: r, g: g, b: b, t: Int( ( ( 1 - a ) * 255 ) ) )
|
||||
}
|
||||
|
||||
// GENERATED
|
||||
open class func rgb(r: Int, g: Int, b: Int) -> Color {
|
||||
return rgbt( r: r, g: g, b: b, t: 0 )
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
open class Drawable {
|
||||
|
||||
open let visible: Bool
|
||||
|
@ -1,6 +1,5 @@
|
||||
import Foundation
|
||||
|
||||
open class Effect {
|
||||
|
||||
open let input: Effect?
|
||||
|
||||
public init(input: Effect?) {
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
open class Fill {
|
||||
|
||||
public init() {
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
open class Font {
|
||||
|
||||
open let name: String
|
||||
|
@ -1,10 +1,8 @@
|
||||
import Foundation
|
||||
|
||||
open class GaussianBlur: Effect {
|
||||
|
||||
open let radius: Double
|
||||
|
||||
public init(radius: Double = 0, input: Effect?) {
|
||||
public init(radius: Double = 0, input: Effect? = nil) {
|
||||
self.radius = radius
|
||||
super.init(input: input)
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
open class Gradient: Fill {
|
||||
|
||||
open let userSpace: Bool
|
||||
|
@ -1,9 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
#if os(iOS)
|
||||
import UIKit
|
||||
#endif
|
||||
|
||||
open class RadialGradient: Gradient {
|
||||
|
||||
open let cx: Double
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
open class Stop {
|
||||
|
||||
open let offset: Double
|
||||
@ -7,13 +5,6 @@ open class Stop {
|
||||
|
||||
public init(offset: Double = 0, color: Color) {
|
||||
self.color = color
|
||||
|
||||
if offset < 0 {
|
||||
self.offset = 0
|
||||
} else if offset > 1 {
|
||||
self.offset = 1
|
||||
} else {
|
||||
self.offset = offset
|
||||
}
|
||||
self.offset = max(0, min(1, offset))
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
open class Stroke {
|
||||
|
||||
open let fill: Fill
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
open class Arc: Locus {
|
||||
|
||||
open let ellipse: Ellipse
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
open class Circle: Locus {
|
||||
|
||||
open let cx: Double
|
||||
@ -20,7 +18,6 @@ open class Circle: Locus {
|
||||
h: r * 2.0)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func arc(shift: Double, extent: Double) -> Arc {
|
||||
return Arc(ellipse: Ellipse(cx: cx, cy: cy, rx: r, ry: r), shift: shift, extent: extent)
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
open class Ellipse: Locus {
|
||||
|
||||
open let cx: Double
|
||||
@ -22,7 +20,6 @@ open class Ellipse: Locus {
|
||||
h: ry * 2.0)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func arc(shift: Double, extent: Double) -> Arc {
|
||||
return Arc(ellipse: self, shift: shift, extent: extent)
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import Foundation
|
||||
|
||||
// TODO need to replace this class with model methods
|
||||
open class GeomUtils {
|
||||
open class func concat(t1: Transform, t2: Transform) -> Transform {
|
||||
let nm11 = t2.m11 * t1.m11 + t2.m12 * t1.m21
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
open class Insets {
|
||||
|
||||
open let top: Double
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
open class Line: Locus {
|
||||
|
||||
open let x1: Double
|
||||
|
@ -1,26 +1,20 @@
|
||||
import Foundation
|
||||
|
||||
open class Locus {
|
||||
|
||||
public init() {
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func bounds() -> Rect {
|
||||
return Rect()
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func stroke(with: Stroke) -> Shape {
|
||||
return Shape(form: self, stroke: with)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func fill(with: Fill) -> Shape {
|
||||
return Shape(form: self, fill: with)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func stroke(fill: Fill = Color.black, width: Double = 1, cap: LineCap = .butt, join: LineJoin = .miter, dashes: [Double] = []) -> Shape {
|
||||
return Shape(form: self, stroke: Stroke(fill: fill, width: width, cap: cap, join: join, dashes: dashes))
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
import Foundation
|
||||
|
||||
open class MoveTo: PathBuilder {
|
||||
|
||||
// GENERATED NOT
|
||||
public init(x: Double, y: Double) {
|
||||
super.init(segment: PathSegment(type: .M, data: [x, y]))
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
public enum FillRule {
|
||||
case nonzero, evenodd
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
open class PathBuilder {
|
||||
|
||||
open let segment: PathSegment
|
||||
@ -10,142 +8,114 @@ open class PathBuilder {
|
||||
self.rest = rest
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func moveTo(x: Double, y: Double) -> PathBuilder {
|
||||
return M(x, y)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func lineTo(x: Double, y: Double) -> PathBuilder {
|
||||
return L(x, y)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func cubicTo(x1: Double, y1: Double, x2: Double, y2: Double, x: Double, y: Double) -> PathBuilder {
|
||||
return C(x1, y1, x2, y2, x, y)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func quadraticTo(x1: Double, y1: Double, x: Double, y: Double) -> PathBuilder {
|
||||
return Q(x1, y1, x, y)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func arcTo(rx: Double, ry: Double, angle: Double, largeArc: Bool, sweep: Bool, x: Double, y: Double) -> PathBuilder {
|
||||
return A(rx, ry, angle, largeArc, sweep, x, y)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func close() -> PathBuilder {
|
||||
return Z()
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func m(_ x: Double, _ y: Double) -> PathBuilder {
|
||||
return PathBuilder(segment: PathSegment(type: .m, data: [x, y]), rest: self)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func M(_ x: Double, _ y: Double) -> PathBuilder {
|
||||
return PathBuilder(segment: PathSegment(type: .M, data: [x, y]), rest: self)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func l(_ x: Double, _ y: Double) -> PathBuilder {
|
||||
return PathBuilder(segment: PathSegment(type: .l, data: [x, y]), rest: self)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func L(_ x: Double, _ y: Double) -> PathBuilder {
|
||||
return PathBuilder(segment: PathSegment(type: .L, data: [x, y]), rest: self)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func h(_ x: Double) -> PathBuilder {
|
||||
return PathBuilder(segment: PathSegment(type: .h, data: [x]), rest: self)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func H(_ x: Double) -> PathBuilder {
|
||||
return PathBuilder(segment: PathSegment(type: .H, data: [x]), rest: self)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func v(_ y: Double) -> PathBuilder {
|
||||
return PathBuilder(segment: PathSegment(type: .v, data: [y]), rest: self)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func V(_ y: Double) -> PathBuilder {
|
||||
return PathBuilder(segment: PathSegment(type: .V, data: [y]), rest: self)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func c(_ x1: Double, _ y1: Double, _ x2: Double, _ y2: Double, _ x: Double, _ y: Double) -> PathBuilder {
|
||||
return PathBuilder(segment: PathSegment(type: .c, data: [x1, y1, x2, y2, x, y]), rest: self)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func C(_ x1: Double, _ y1: Double, _ x2: Double, _ y2: Double, _ x: Double, _ y: Double) -> PathBuilder {
|
||||
return PathBuilder(segment: PathSegment(type: .C, data: [x1, y1, x2, y2, x, y]), rest: self)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func s(_ x2: Double, _ y2: Double, _ x: Double, _ y: Double) -> PathBuilder {
|
||||
return PathBuilder(segment: PathSegment(type: .s, data: [x2, y2, x, y]), rest: self)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func S(_ x2: Double, _ y2: Double, _ x: Double, _ y: Double) -> PathBuilder {
|
||||
return PathBuilder(segment: PathSegment(type: .S, data: [x2, y2, x, y]), rest: self)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func q(_ x1: Double, _ y1: Double, _ x: Double, _ y: Double) -> PathBuilder {
|
||||
return PathBuilder(segment: PathSegment(type: .q, data: [x1, y1, x, y]), rest: self)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func Q(_ x1: Double, _ y1: Double, _ x: Double, _ y: Double) -> PathBuilder {
|
||||
return PathBuilder(segment: PathSegment(type: .Q, data: [x1, y1, x, y]), rest: self)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func t(_ x: Double, _ y: Double) -> PathBuilder {
|
||||
return PathBuilder(segment: PathSegment(type: .t, data: [x, y]), rest: self)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func T(_ x: Double, _ y: Double) -> PathBuilder {
|
||||
return PathBuilder(segment: PathSegment(type: .T, data: [x, y]), rest: self)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func a(_ rx: Double, _ ry: Double, _ angle: Double, _ largeArc: Bool, _ sweep: Bool, _ x: Double, _ y: Double) -> PathBuilder {
|
||||
return PathBuilder(segment: PathSegment(type: .a, data: [rx, ry, angle, boolToNum(largeArc), boolToNum(sweep), x, y]), rest: self)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func A(_ rx: Double, _ ry: Double, _ angle: Double, _ largeArc: Bool, _ sweep: Bool, _ x: Double, _ y: Double) -> PathBuilder {
|
||||
return PathBuilder(segment: PathSegment(type: .A, data: [rx, ry, angle, boolToNum(largeArc), boolToNum(sweep), x, y]), rest: self)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func e(_ x: Double, _ y: Double, _ w: Double, _ h: Double, _ startAngle: Double, _ arcAngle: Double) -> PathBuilder {
|
||||
return PathBuilder(segment: PathSegment(type: .e, data: [x, y, w, h, startAngle, arcAngle]), rest: self)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func E(_ x: Double, _ y: Double, _ w: Double, _ h: Double, _ startAngle: Double, _ arcAngle: Double) -> PathBuilder {
|
||||
return PathBuilder(segment: PathSegment(type: .E, data: [x, y, w, h, startAngle, arcAngle]), rest: self)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func Z() -> PathBuilder {
|
||||
return PathBuilder(segment: PathSegment(type: .z), rest: self)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func build() -> Path {
|
||||
var segments: [PathSegment] = []
|
||||
var builder: PathBuilder? = self
|
||||
@ -156,7 +126,6 @@ open class PathBuilder {
|
||||
return Path(segments: segments.reversed())
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
fileprivate func boolToNum(_ value: Bool) -> Double {
|
||||
return value ? 1 : 0
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ open class PathSegment {
|
||||
self.data = data
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func isAbsolute() -> Bool {
|
||||
switch type {
|
||||
case .M, .L, .H, .V, .C, .S, .Q, .T, .A, .E:
|
||||
|
@ -1,9 +0,0 @@
|
||||
//
|
||||
// PathUtils.swift
|
||||
// MacawTests
|
||||
//
|
||||
// Created by Yuriy Kashnikov on 10/18/17.
|
||||
// Copyright © 2017 Exyte. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
open class Point: Locus {
|
||||
|
||||
open let x: Double
|
||||
@ -20,7 +18,6 @@ open class Point: Locus {
|
||||
h: 0.0)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func add(_ point: Point) -> Point {
|
||||
return Point(
|
||||
x: self.x + point.x,
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
open class Rect: Locus {
|
||||
|
||||
open let x: Double
|
||||
@ -18,27 +16,22 @@ open class Rect: Locus {
|
||||
return self
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func round(rx: Double, ry: Double) -> RoundRect {
|
||||
return RoundRect(rect: self, rx: rx, ry: ry)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
public func round(r: Double) -> RoundRect {
|
||||
return RoundRect(rect: self, rx: r, ry: r)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func contains(locus: Locus) -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
class func zero() -> Rect {
|
||||
return Rect(x: 0.0, y: 0.0, w: 0.0, h: 0.0)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func move(offset: Point) -> Rect {
|
||||
return Rect(
|
||||
x: self.x + offset.x,
|
||||
@ -47,7 +40,6 @@ open class Rect: Locus {
|
||||
h: self.h)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
open func union(rect: Rect) -> Rect {
|
||||
return Rect(
|
||||
x: min(self.x, rect.x),
|
||||
@ -56,6 +48,10 @@ open class Rect: Locus {
|
||||
h: max(self.y + self.h, rect.y + rect.h) - min(self.y, rect.y))
|
||||
}
|
||||
|
||||
open func size() -> Size {
|
||||
return Size(w: w, h: h)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension Rect {
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
open class RoundRect: Locus {
|
||||
|
||||
open let rect: Rect
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
open class Size {
|
||||
|
||||
open let w: Double
|
||||
|
@ -20,62 +20,51 @@ public final class Transform {
|
||||
self.dy = dy
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
public func move(dx: Double, dy: Double) -> Transform {
|
||||
return Transform(m11: m11, m12: m12, m21: m21, m22: m22,
|
||||
dx: dx * m11 + dy * m21 + self.dx, dy: dx * m12 + dy * m22 + self.dy)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
public func scale(sx: Double, sy: Double) -> Transform {
|
||||
return Transform(m11: m11 * sx, m12: m12 * sx, m21: m21 * sy, m22: m22 * sy, dx: dx, dy: dy)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
public func rotate(angle: Double, x: Double, y: Double) -> Transform {
|
||||
return move(dx: x, dy: y).rotate(angle: angle).move(dx: -x, dy: -y)
|
||||
}
|
||||
|
||||
// GENERATED
|
||||
public class func move(dx: Double, dy: Double) -> Transform {
|
||||
return Transform(dx: dx, dy: dy)
|
||||
}
|
||||
|
||||
// GENERATED
|
||||
public class func scale(sx: Double, sy: Double) -> Transform {
|
||||
return Transform(m11: sx, m22: sy)
|
||||
}
|
||||
|
||||
// GENERATED
|
||||
public class func shear(shx: Double, shy: Double) -> Transform {
|
||||
return Transform(m12: shy, m21: shx)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
public class func rotate(angle: Double) -> Transform {
|
||||
let asin = sin(angle); let acos = cos(angle)
|
||||
return Transform(m11: acos, m12: asin, m21: -asin, m22: acos)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
public class func rotate(angle: Double, x: Double, y: Double) -> Transform {
|
||||
return Transform.move(dx: x, dy: y).rotate(angle: angle).move(dx: -x, dy: -y)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
public func invert() -> Transform? {
|
||||
let det = self.m11 * self.m22 - self.m12 * self.m21
|
||||
if det == 0 {
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
open class Group: Node {
|
||||
|
||||
open var contentsVar: AnimatableVariable<[Node]>
|
||||
@ -64,7 +62,6 @@ open class Group: Node {
|
||||
return result
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
override internal func bounds() -> Rect? {
|
||||
var union: Rect?
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
#if os(OSX)
|
||||
import AppKit
|
||||
#endif
|
||||
|
@ -315,7 +315,6 @@ open class Node: Drawable {
|
||||
Node.map.setObject(self, forKey: self.id as NSString)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
internal func bounds() -> Rect? {
|
||||
return Rect()
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
open class Shape: Node {
|
||||
|
||||
open let formVar: AnimatableVariable<Locus>
|
||||
@ -39,7 +37,6 @@ open class Shape: Node {
|
||||
self.fillVar.node = self
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
override internal func bounds() -> Rect? {
|
||||
var bounds = form.bounds()
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
#if os(iOS)
|
||||
import UIKit
|
||||
#elseif os(OSX)
|
||||
@ -62,7 +60,6 @@ open class Text: Node {
|
||||
)
|
||||
}
|
||||
|
||||
// GENERATED NOT
|
||||
override internal func bounds() -> Rect {
|
||||
let font: MFont
|
||||
if let f = self.font {
|
||||
|
Loading…
Reference in New Issue
Block a user