mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-07 08:45:00 +00:00
Refactor Symbol on iOS
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
#import "RNSVGSvgView.h"
|
||||
|
||||
#import "RNSVGViewBox.h"
|
||||
#import "RNSVGNode.h"
|
||||
#import <React/RCTLog.h>
|
||||
|
||||
@@ -42,6 +42,66 @@
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
|
||||
- (void)setMinX:(CGFloat)minX
|
||||
{
|
||||
if (minX == _minX) {
|
||||
return;
|
||||
}
|
||||
|
||||
[self invalidate];
|
||||
_minX = minX;
|
||||
}
|
||||
|
||||
- (void)setMinY:(CGFloat)minY
|
||||
{
|
||||
if (minY == _minY) {
|
||||
return;
|
||||
}
|
||||
|
||||
[self invalidate];
|
||||
_minY = minY;
|
||||
}
|
||||
|
||||
- (void)setVbWidth:(CGFloat)vbWidth
|
||||
{
|
||||
if (vbWidth == _vbWidth) {
|
||||
return;
|
||||
}
|
||||
|
||||
[self invalidate];
|
||||
_vbWidth = vbWidth;
|
||||
}
|
||||
|
||||
- (void)setVbHeight:(CGFloat)vbHeight
|
||||
{
|
||||
if (_vbHeight == vbHeight) {
|
||||
return;
|
||||
}
|
||||
|
||||
[self invalidate];
|
||||
_vbHeight = vbHeight;
|
||||
}
|
||||
|
||||
- (void)setAlign:(NSString *)align
|
||||
{
|
||||
if ([align isEqualToString:_align]) {
|
||||
return;
|
||||
}
|
||||
|
||||
[self invalidate];
|
||||
_align = align;
|
||||
}
|
||||
|
||||
- (void)setMeetOrSlice:(RNSVGVBMOS)meetOrSlice
|
||||
{
|
||||
if (meetOrSlice == _meetOrSlice) {
|
||||
return;
|
||||
}
|
||||
|
||||
[self invalidate];
|
||||
_meetOrSlice = meetOrSlice;
|
||||
}
|
||||
|
||||
- (void)drawRect:(CGRect)rect
|
||||
{
|
||||
clipPaths = nil;
|
||||
@@ -50,6 +110,15 @@
|
||||
_boundingBox = rect;
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
|
||||
if (self.align) {
|
||||
CGAffineTransform viewBoxTransform = [RNSVGViewBox getTransform:CGRectMake(self.minX, self.minY, self.vbWidth, self.vbHeight)
|
||||
eRect:rect
|
||||
align:self.align
|
||||
meetOrSlice:self.meetOrSlice
|
||||
fromSymbol:NO];
|
||||
CGContextConcatCTM(context, viewBoxTransform);
|
||||
}
|
||||
|
||||
for (RNSVGNode *node in self.subviews) {
|
||||
if ([node isKindOfClass:[RNSVGNode class]]) {
|
||||
if (node.responsible && !self.responsible) {
|
||||
|
||||
Reference in New Issue
Block a user