// // MPExpression+MPDisplayExtension.m // MathPad // // Created by Kim Wittenburg on 23.04.14. // Copyright (c) 2014 Kim Wittenburg. All rights reserved. // #import "MPDisplayExtension.h" @implementation MPExpression (MPDisplayExtension) - (void)subexpressionChangedAtRangePath:(MPRangePath *)rangePath { NSUInteger index = [self.parent indexOfChild:self]; NSIndexPath *newLocation = [rangePath.location indexPathByPrecedingIndex:index]; [self.parent subexpressionChangedAtRangePath:[[MPRangePath alloc] initWithLocation:newLocation length:rangePath.length]]; } @end @implementation MPFunction (MPDisplayExtension) - (void)subexpressionChangedAtRangePath:(MPRangePath *)rangePath { NSUInteger index = [self.parent indexOfSymbol:self]; NSIndexPath *newLocation = [rangePath.location indexPathByPrecedingIndex:index]; [self.parent subexpressionChangedAtRangePath:[[MPRangePath alloc] initWithLocation:newLocation length:rangePath.length]]; } @end