Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to reset text - meaning a user can move it off screen and res… #29

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions jot/JotTextView.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@
*/
- (void)clearText;

/**
* Resets the text position, allowing you to start manipulating from scratch.
*/
- (void)resetText;

/**
* Overlays the text on the given background image.
*
Expand Down
7 changes: 7 additions & 0 deletions jot/JotTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ - (void)clearText
self.textString = @"";
}

-(void)resetText{
[self setFontSize:60.f];
[self setScale:1.f];
[self sizeLabel];
self.textLabel.center = CGPointMake(CGRectGetMidX(self.bounds),CGRectGetMidY(self.bounds));
}

#pragma mark - Properties

- (void)setTextString:(NSString *)textString
Expand Down
5 changes: 5 additions & 0 deletions jot/JotViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ typedef NS_ENUM(NSUInteger, JotViewState){

@property (nonatomic, strong, readonly) JotDrawingContainer *drawingContainer;

/**
* Resets the text position, allowing you to start manipulating from scratch.
*/
-(void)resetText;

/**
* Clears all paths from the drawing in and sets the text to an empty string, giving a blank slate.
*/
Expand Down
4 changes: 4 additions & 0 deletions jot/JotViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ - (void)setDrawingConstantStrokeWidth:(BOOL)drawingConstantStrokeWidth

#pragma mark - Undo

- (void)resetText {
[self.textView resetText];
}

- (void)clearAll
{
[self clearDrawing];
Expand Down