forked from SVGKit/SVGKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSVGUseElement.m
More file actions
41 lines (31 loc) · 1.37 KB
/
Copy pathSVGUseElement.m
File metadata and controls
41 lines (31 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#import "SVGUseElement.h"
#import "SVGUseElement_Mutable.h"
@implementation SVGUseElement
@synthesize x;
@synthesize y;
@synthesize width;
@synthesize height;
@synthesize instanceRoot;
@synthesize animatedInstanceRoot;
@synthesize transform; // each SVGElement subclass that conforms to protocol "SVGTransformable" has to re-synthesize this to work around bugs in Apple's Objective-C 2.0 design that don't allow @properties to be extended by categories / protocols
-(CALayer *)newLayer
{
if( [instanceRoot.correspondingElement respondsToSelector:@selector(newLayer)])
{
CALayer* initialLayer = [((SVGElement<SVGLayeredElement>*)instanceRoot.correspondingElement) newLayer];
if( CGRectIsEmpty( initialLayer.frame ) ) // Avoid Apple's UIKit getting upset by infinitely large/small areas due to floating point inaccuracy
return initialLayer;
//For Xcode's broken debugger: CGAffineTransform i = initialLayer.affineTransform;
//For Xcode's broken debugger: CGAffineTransform mine = self.transform;
initialLayer.affineTransform = CGAffineTransformConcat( self.transform, initialLayer.affineTransform );
return initialLayer;
}
else
return nil;
}
-(void)layoutLayer:(CALayer *)layer
{
if( [instanceRoot.correspondingElement respondsToSelector:@selector(layoutLayer:)])
[((SVGElement<SVGLayeredElement>*)instanceRoot.correspondingElement) layoutLayer:layer];
}
@end