Files
IJSVG/source/IJSVGCommandMove.m
T
Curtis Hard 613bf38ba7 Fixed move command issue
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
2014-10-26 12:57:27 +00:00

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