Commit f30383c5 authored by PhoeniX's avatar PhoeniX

Pattern parser core (not works)

Refactoring
parent 7b8e401c
......@@ -9,5 +9,14 @@
#import "pxSVGGroup.h"
@implementation pxSVGGroup
- (CGRect)bounds
{
CGRect f = CGRectNull;
for (pxSVGObject *o in [self subnodes]) {
f = CGRectUnion(f, o.bounds);
}
if (CGRectIsNull(f)) return f;
return CGRectApplyAffineTransform(f, CATransform3DGetAffineTransform(self.transform));
}
@end
......@@ -22,4 +22,5 @@
@property CGFloat opacity;
@property CGFloat fillOpacity;
@property CATransform3D transform;
@property (nonatomic,readonly) CGRect bounds;
@end
......@@ -117,4 +117,8 @@
self.fillOpacity = [ma objectForKey:@"fill-opacity"]?[[ma objectForKey:@"fill-opacity"] doubleValue]:a;
}
- (void)setSubnodes:(NSArray *)subnodes { }
- (CGRect)bounds
{
return CGRectNull;
}
@end
......@@ -198,4 +198,9 @@
self.d = [UIBezierPath bezierPathWithRect:r];
} else NSLog(@"%@",attributes);
}
- (CGRect)bounds
{
if (self.d) return CGRectApplyAffineTransform(self.d.bounds, CATransform3DGetAffineTransform(self.transform));
return CGRectNull;
}
@end
This diff is collapsed.
......@@ -28,6 +28,7 @@
- (void)layoutSublayersOfLayer:(CALayer *)layer
{
[super layoutSublayersOfLayer:layer];
if (layer != self.layer) return;
self.svgLayer.transform = CATransform3DIdentity;
[self.svgLayer setFrame:self.layer.bounds];
......@@ -51,7 +52,6 @@
- (void)svgLayerDidLoadImage:(pxSVGLayer *)svgLayer
{
[self setNeedsLayout];
[self layoutSublayersOfLayer:self.layer];
[self setNeedsDisplay];
if ([self.svgDelegate respondsToSelector:@selector(svgViewDidLoadImage:)])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment