mirror of
https://github.com/exyte/Macaw.git
synced 2024-09-11 05:05:23 +03:00
Code review improvements
This commit is contained in:
parent
5ea809f7b3
commit
4f23e4672a
@ -498,7 +498,7 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE = "";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 4.2;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@ -516,7 +516,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.exyte.Example.Example;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE = "";
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 4.2;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -12,19 +12,21 @@ import XCTest
|
||||
class AnimationUtilsTests: XCTestCase {
|
||||
|
||||
func testIndex() {
|
||||
let shape = Circle(cx: 0, cy: 0, r: 10)
|
||||
|
||||
let rootGroup = Group()
|
||||
let a = Shape(form: Locus())
|
||||
let a = Shape(form: shape)
|
||||
rootGroup.contents.append(a)
|
||||
|
||||
let bGroup = Group()
|
||||
let c = Shape(form: Locus())
|
||||
let d = Shape(form: Locus())
|
||||
let c = Shape(form: shape)
|
||||
let d = Shape(form: shape)
|
||||
bGroup.contents.append(c)
|
||||
bGroup.contents.append(d)
|
||||
rootGroup.contents.append(bGroup)
|
||||
|
||||
let e = Shape(form: Locus())
|
||||
let f = Shape(form: Locus())
|
||||
let e = Shape(form: shape)
|
||||
let f = Shape(form: shape)
|
||||
rootGroup.contents.append(e)
|
||||
rootGroup.contents.append(f)
|
||||
|
||||
|
@ -86,7 +86,7 @@ class AnimationProducer {
|
||||
break
|
||||
}
|
||||
|
||||
guard let macawView = animation.nodeRenderer?.view as? MacawView else {
|
||||
guard let macawView = animation.nodeRenderer?.view else {
|
||||
storedAnimations[node] = animation
|
||||
return
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ class AnimationUtils {
|
||||
while parentRenderer != nil {
|
||||
|
||||
if let canvas = parentRenderer?.node() as? SVGCanvas,
|
||||
let view = parentRenderer?.view as? MacawView {
|
||||
let view = parentRenderer?.view {
|
||||
let rect = canvas.layout(size: view.bounds.size.toMacaw()).rect()
|
||||
let canvasTransform = view.contentLayout.layout(rect: rect, into: view.bounds.size.toMacaw()).move(dx: rect.x, dy: rect.y)
|
||||
transform = canvasTransform.concat(with: transform)
|
||||
|
@ -9,7 +9,7 @@ class GroupRenderer: NodeRenderer {
|
||||
weak var group: Group?
|
||||
var renderers: [NodeRenderer] = []
|
||||
|
||||
init(group: Group, view: MView?, animationCache: AnimationCache?) {
|
||||
init(group: Group, view: MacawView?, animationCache: AnimationCache?) {
|
||||
self.group = group
|
||||
super.init(node: group, view: view, animationCache: animationCache)
|
||||
updateRenderers()
|
||||
|
@ -13,7 +13,7 @@ class ImageRenderer: NodeRenderer {
|
||||
|
||||
var renderedPaths: [CGPath] = [CGPath]()
|
||||
|
||||
init(image: Image, view: MView?, animationCache: AnimationCache?) {
|
||||
init(image: Image, view: MacawView?, animationCache: AnimationCache?) {
|
||||
self.image = image
|
||||
super.init(node: image, view: view, animationCache: animationCache)
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ enum ColoringMode {
|
||||
|
||||
class NodeRenderer {
|
||||
|
||||
weak var view: MView?
|
||||
weak var view: MacawView?
|
||||
weak var parentRenderer: NodeRenderer?
|
||||
internal var zPosition: Int = 0
|
||||
|
||||
@ -21,7 +21,7 @@ class NodeRenderer {
|
||||
fileprivate var active = false
|
||||
weak var animationCache: AnimationCache?
|
||||
|
||||
init(node: Node, view: MView?, animationCache: AnimationCache?) {
|
||||
init(node: Node, view: MacawView?, animationCache: AnimationCache?) {
|
||||
self.view = view
|
||||
self.animationCache = animationCache
|
||||
|
||||
@ -306,7 +306,7 @@ class NodeRenderer {
|
||||
group.contents = contents
|
||||
}
|
||||
|
||||
if let hostingView = view as? MacawView, hostingView.node == node {
|
||||
if let hostingView = view, hostingView.node == node {
|
||||
hostingView.node = replacementNode
|
||||
}
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ import UIKit
|
||||
#endif
|
||||
|
||||
class RenderContext {
|
||||
weak var view: MView?
|
||||
weak var view: MacawView?
|
||||
var cgContext: CGContext?
|
||||
|
||||
init(view: MView?) {
|
||||
init(view: MacawView?) {
|
||||
self.view = view
|
||||
self.cgContext = nil
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ class RenderUtils {
|
||||
|
||||
class func createNodeRenderer(
|
||||
_ node: Node,
|
||||
view: MView?,
|
||||
view: MacawView?,
|
||||
animationCache: AnimationCache?
|
||||
) -> NodeRenderer {
|
||||
if let group = node as? Group {
|
||||
|
@ -10,7 +10,7 @@ class ShapeRenderer: NodeRenderer {
|
||||
|
||||
weak var shape: Shape?
|
||||
|
||||
init(shape: Shape, view: MView?, animationCache: AnimationCache?) {
|
||||
init(shape: Shape, view: MacawView?, animationCache: AnimationCache?) {
|
||||
self.shape = shape
|
||||
super.init(node: shape, view: view, animationCache: animationCache)
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import AppKit
|
||||
class TextRenderer: NodeRenderer {
|
||||
weak var text: Text?
|
||||
|
||||
init(text: Text, view: MView?, animationCache: AnimationCache?) {
|
||||
init(text: Text, view: MacawView?, animationCache: AnimationCache?) {
|
||||
self.text = text
|
||||
super.init(node: text, view: view, animationCache: animationCache)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user