Files
react-native-svg/ios/Elements/RNSVGPattern.m
2018-09-02 16:06:44 +03:00

38 lines
1.0 KiB
Objective-C

/**
* Copyright (c) 2015-present, Horcrux.
* All rights reserved.
*
* This source code is licensed under the MIT-style license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "RNSVGPattern.h"
#import "RNSVGPainter.h"
#import "RNSVGBrushType.h"
#import "RNSVGNode.h"
@implementation RNSVGPattern
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
return nil;
}
- (void)parseReference
{
NSArray<NSString *> *points = @[self.x, self.y, self.patternwidth, self.patternheight];
RNSVGPainter *painter = [[RNSVGPainter alloc] initWithPointsArray:points];
[painter setUnits:self.patternUnits];
[painter setContentUnits:self.patternContentUnits];
[painter setTransform:self.patternTransform];
[painter setPattern:self];
if (self.patternUnits == kRNSVGUnitsUserSpaceOnUse || self.patternContentUnits == kRNSVGUnitsUserSpaceOnUse) {
[painter setUserSpaceBoundingBox:[self.svgView getContextBounds]];
}
[self.svgView definePainter:painter painterName:self.name];
}
@end