Archived
1
This repository has been archived on 2022-08-08. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
mathpad/MathPad/MPDisplayExtension.m
Kim Wittenburg fa499d299c Renamed NSIndexPath+MPRemoveFirstIndex Category to NSIndexPath+MPReverseIndexPath
Added MPDisplayExtension Category to MPExpression and MPFunction
Added Methods to Invalidate the Cache to MPExpressionLayout and MPFunctionLayout
2014-04-23 16:05:20 +02:00

34 lines
1.1 KiB
Objective-C

//
// 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