Skip to content

Commit

Permalink
Merge pull request #46 from meitu/feature/gzm/test
Browse files Browse the repository at this point in the history
【Bugfix】扩大热区,保证响应有效
  • Loading branch information
bobbeat authored Apr 10, 2023
2 parents c500f6b + af7ef50 commit 3d8e873
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Sources/MPILabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,11 @@ - (CGRect)grabberRectForGrabberType:(MPITextSelectionGrabberType)grabberType {
- (NSUInteger)characterIndexForPoint:(CGPoint)point {
MPITextRenderer *renderer = [self currentRenderer];
point = [self convertPointToTextKit:point forBounds:self.bounds textSize:renderer.size];
CGFloat pointX = MIN(point.x, renderer.size.width) - 1;
CGFloat pointY = MIN(point.y, renderer.size.height) - 1;
pointX = pointX < 0 ? 1 : pointX;
pointY = pointY < 0 ? 1 : pointY;
point = CGPointMake(pointX, pointY);
return [renderer characterIndexForPoint:point];
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/MPITextSelectionView.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#import "MPITextSelectionView.h"
#import "MPITextGeometryHelpers.h"

#define kGrabberTouchHitTestExtend 14.0
#define kGrabberTouchHitTestExtend 20.0
#define kKnobTouchHitTestExtend 7.0
#define kSelectionAlpha 0.2

Expand Down

0 comments on commit 3d8e873

Please sign in to comment.