Removed layer

This commit is contained in:
Brandon Withrow
2016-08-16 15:29:47 -07:00
parent cbf43d35ae
commit fc77bffe3f
4 changed files with 2 additions and 172 deletions

View File

@@ -68,8 +68,6 @@
48E774AA1D4AABF00029FC2D /* UIColor+Expanded.m in Sources */ = {isa = PBXBuildFile; fileRef = 48E774A41D4AABF00029FC2D /* UIColor+Expanded.m */; };
48E774AB1D4AABF00029FC2D /* CGGeometryAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 48E774A51D4AABF00029FC2D /* CGGeometryAdditions.h */; };
48E774AC1D4AABF00029FC2D /* CGGeometryAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 48E774A61D4AABF00029FC2D /* CGGeometryAdditions.m */; };
6294E63B1D62851000EC2F0F /* LAShapeLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 6294E6391D62851000EC2F0F /* LAShapeLayer.h */; };
6294E63C1D62851000EC2F0F /* LAShapeLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 6294E63A1D62851000EC2F0F /* LAShapeLayer.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -137,8 +135,6 @@
48E774A51D4AABF00029FC2D /* CGGeometryAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGGeometryAdditions.h; sourceTree = "<group>"; };
48E774A61D4AABF00029FC2D /* CGGeometryAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CGGeometryAdditions.m; sourceTree = "<group>"; };
48E774AF1D4AAD2E0029FC2D /* LAHelpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LAHelpers.h; sourceTree = "<group>"; };
6294E6391D62851000EC2F0F /* LAShapeLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LAShapeLayer.h; sourceTree = "<group>"; };
6294E63A1D62851000EC2F0F /* LAShapeLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LAShapeLayer.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -193,8 +189,6 @@
48E7743C1D4AABB70029FC2D /* LAMaskLayer.m */,
48E7743D1D4AABB70029FC2D /* LAGroupLayerView.h */,
48E7743E1D4AABB70029FC2D /* LAGroupLayerView.m */,
6294E6391D62851000EC2F0F /* LAShapeLayer.h */,
6294E63A1D62851000EC2F0F /* LAShapeLayer.m */,
48E7743F1D4AABB70029FC2D /* LAShapeLayerView.h */,
48E774401D4AABB70029FC2D /* LAShapeLayerView.m */,
48E774411D4AABB70029FC2D /* LARectShapeLayer.h */,
@@ -290,7 +284,6 @@
48E774981D4AABDA0029FC2D /* LAShapeTransform.h in Headers */,
48E7744D1D4AABB70029FC2D /* LAShapeLayerView.h in Headers */,
48E7747A1D4AABDA0029FC2D /* LAModels.h in Headers */,
6294E63B1D62851000EC2F0F /* LAShapeLayer.h in Headers */,
48E774801D4AABDA0029FC2D /* LAAnimatableNumberValue.h in Headers */,
48E774901D4AABDA0029FC2D /* LAShapeGroup.h in Headers */,
48E774A71D4AABF00029FC2D /* BWMath.h in Headers */,
@@ -376,7 +369,6 @@
files = (
48E774501D4AABB70029FC2D /* LARectShapeLayer.m in Sources */,
48E774AC1D4AABF00029FC2D /* CGGeometryAdditions.m in Sources */,
6294E63C1D62851000EC2F0F /* LAShapeLayer.m in Sources */,
48E774891D4AABDA0029FC2D /* CAAnimationGroup+LAAnimatableGroup.m in Sources */,
48E7747D1D4AABDA0029FC2D /* LAAnimatableColorValue.m in Sources */,
48E7749D1D4AABDA0029FC2D /* LAShapeCircle.m in Sources */,

View File

@@ -1,29 +0,0 @@
//
// LAShapeLayer.h
// Lotte
//
// Created by brandon_withrow on 8/15/16.
// Copyright © 2016 Brandon Withrow. All rights reserved.
//
#import <QuartzCore/QuartzCore.h>
@interface LAShapeLayer : CALayer
// Animatable
@property(nullable) CGPathRef path;
@property(nullable) CGColorRef fillColor;
@property(nullable) CGColorRef strokeColor;
@property CGFloat lineWidth;
@property CGFloat strokeStart;
@property CGFloat strokeEnd;
@property CGFloat strokeOffset;
@property CGFloat strokeOpacity;
@property CGFloat fillOpacity;
//Static
@property(nullable, copy) NSArray<NSNumber *> *lineDashPattern;
@property(copy) NSString *lineCap;
@property(copy) NSString *lineJoin;
@end

View File

@@ -1,132 +0,0 @@
//
// LAShapeLayer.m
// Lotte
//
// Created by brandon_withrow on 8/15/16.
// Copyright © 2016 Brandon Withrow. All rights reserved.
//
#import "LAShapeLayer.h"
@implementation LAShapeLayer {
CAShapeLayer *_strokeLayer;
CAShapeLayer *_strokeOffsetLayer;
CAShapeLayer *_fillLayer;
}
@dynamic path, fillColor, strokeColor, lineWidth, strokeStart, strokeEnd, strokeOffset, fillOpacity, strokeOpacity;
- (instancetype)init {
self = [super init];
if (self) {
[self _commonInit];
}
return self;
}
- (instancetype)initWithLayer:(id)layer {
if( ( self = [super initWithLayer:layer] ) ) {
[self _commonInit];
if ([layer isKindOfClass:[LAShapeLayer class]]) {
self.path = ((LAShapeLayer *)layer).path;
self.fillColor = ((LAShapeLayer *)layer).fillColor;
self.strokeColor = ((LAShapeLayer *)layer).strokeColor;
self.lineWidth = ((LAShapeLayer *)layer).lineWidth;
self.strokeStart = ((LAShapeLayer *)layer).strokeStart;
self.strokeEnd = ((LAShapeLayer *)layer).strokeEnd;
self.strokeOffset = ((LAShapeLayer *)layer).strokeOffset;
self.lineDashPattern = ((LAShapeLayer *)layer).lineDashPattern;
self.lineCap = ((LAShapeLayer *)layer).lineCap;
self.lineJoin = ((LAShapeLayer *)layer).lineJoin;
self.fillOpacity = ((LAShapeLayer *)layer).fillOpacity;
self.strokeOpacity = ((LAShapeLayer *)layer).strokeOpacity;
}
}
return self;
}
- (void)_commonInit {
_fillLayer = [CAShapeLayer layer];
_fillLayer.allowsEdgeAntialiasing = YES;
[self addSublayer:_fillLayer];
_strokeLayer = [CAShapeLayer layer];
_strokeLayer.fillColor = nil;
_strokeLayer.allowsEdgeAntialiasing = YES;
[self addSublayer:_strokeLayer];
_strokeOffsetLayer = [CAShapeLayer layer];
_strokeOffsetLayer.fillColor = nil;
_strokeOffsetLayer.allowsEdgeAntialiasing = YES;
[self addSublayer:_strokeOffsetLayer];
}
- (void)setLineCap:(NSString *)lineCap {
_lineCap = lineCap;
_strokeLayer.lineCap = lineCap;
_strokeOffsetLayer.lineCap = lineCap;
}
- (void)setLineJoin:(NSString *)lineJoin {
_lineJoin = lineJoin;
_strokeLayer.lineJoin = lineJoin;
_strokeOffsetLayer.lineJoin = lineJoin;
}
- (void)setLineDashPattern:(NSArray<NSNumber *> *)lineDashPattern {
_lineDashPattern = lineDashPattern;
_strokeOffsetLayer.lineDashPattern = lineDashPattern;
_strokeLayer.lineDashPattern = lineDashPattern;
}
+ (BOOL)needsDisplayForKey:(NSString *)key {
BOOL needsDisplay = [super needsDisplayForKey:key];
if ([key isEqualToString:@"path"] ||
[key isEqualToString:@"fillColor"] ||
[key isEqualToString:@"strokeColor"] ||
[key isEqualToString:@"lineWidth"] ||
[key isEqualToString:@"strokeStart"] ||
[key isEqualToString:@"strokeEnd"] ||
[key isEqualToString:@"strokeOffset"] ||
[key isEqualToString:@"fillOpacity"] ||
[key isEqualToString:@"strokeOpacity"]) {
needsDisplay = YES;
}
return needsDisplay;
}
-(id<CAAction>)actionForKey:(NSString *)event {
if([event isEqualToString:@"path"] ||
[event isEqualToString:@"fillColor"] ||
[event isEqualToString:@"strokeColor"] ||
[event isEqualToString:@"lineWidth"] ||
[event isEqualToString:@"strokeStart"] ||
[event isEqualToString:@"strokeEnd"] ||
[event isEqualToString:@"strokeOffset"] ||
[event isEqualToString:@"fillOpacity"] ||
[event isEqualToString:@"strokeOpacity"]) {
CABasicAnimation *theAnimation = [CABasicAnimation
animationWithKeyPath:event];
theAnimation.fromValue = [[self presentationLayer] valueForKey:event];
return theAnimation;
}
return [super actionForKey:event];
}
- (void)display {
LAShapeLayer *displayLayer = (LAShapeLayer *)self.presentationLayer;
if (displayLayer == nil) {
displayLayer = self;
}
_fillLayer.path = displayLayer.path;
_fillLayer.fillColor = displayLayer.fillColor;
_fillLayer.opacity = displayLayer.fillOpacity;
_strokeLayer.path = displayLayer.path;
_strokeLayer.strokeColor = displayLayer.strokeColor;
_strokeLayer.lineWidth = displayLayer.lineWidth;
_strokeLayer.opacity = displayLayer.strokeOpacity;
}
@end

View File

@@ -8,7 +8,6 @@
#import "LAShapeLayerView.h"
#import "CAAnimationGroup+LAAnimatableGroup.h"
#import "LAShapeLayer.h"
@implementation LAShapeLayerView {
LAShapeTransform *_transform;
@@ -17,8 +16,8 @@
LAShapePath *_path;
LAShapeTrimPath *_trim;
LAShapeLayer *_fillLayer;
LAShapeLayer *_strokeLayer;
CAShapeLayer *_fillLayer;
CAShapeLayer *_strokeLayer;
CAAnimationGroup *_animation;
CAAnimationGroup *_strokeAnimation;