Some SVG's use a relative move to command as the first command in the path, I dont know why, they should be absolute, so this is a work around for them as they will normally crash the bezier path
45 lines
966 B
Objective-C
45 lines
966 B
Objective-C
//
|
|
// IJSVGCommandMove.m
|
|
// IconJar
|
|
//
|
|
// Created by Curtis Hard on 30/08/2014.
|
|
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
|
//
|
|
|
|
#import "IJSVGCommandMove.h"
|
|
|
|
|
|
@implementation IJSVGCommandMove
|
|
|
|
+ (void)load
|
|
{
|
|
[IJSVGCommand registerClass:[self class]
|
|
forCommand:@"m"];
|
|
}
|
|
|
|
+ (NSInteger)requiredParameterCount
|
|
{
|
|
return 2;
|
|
}
|
|
|
|
+ (void)runWithParams:(CGFloat *)params
|
|
paramCount:(NSInteger)count
|
|
previousCommand:(IJSVGCommand *)command
|
|
type:(IJSVGCommandType)type
|
|
path:(IJSVGPath *)path
|
|
{
|
|
if( type == IJSVGCommandTypeAbsolute )
|
|
{
|
|
[[path currentSubpath] moveToPoint:NSMakePoint( params[0], params[1])];
|
|
return;
|
|
}
|
|
@try {
|
|
[[path currentSubpath] relativeMoveToPoint:NSMakePoint( params[0], params[1])];
|
|
}
|
|
@catch (NSException *exception) {
|
|
[[path currentSubpath] moveToPoint:NSMakePoint( params[0], params[1])];
|
|
}
|
|
}
|
|
|
|
@end
|