-
Notifications
You must be signed in to change notification settings - Fork 892
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
Fix highlight overlapping #1098
Conversation
This patch fixes highlight overlapping by removing rectangles that overlap each other. It also changes the threshold of considering a line to be a "full line" to be a percentage of the page size, which should help fix some cases where the highlighting on the left or right side does not form a straight vertical line. Fixes #951.
@@ -31,4 +32,8 @@ public AyahInfoDatabaseHandler getAyahInfoHandler() { | |||
} | |||
return databaseHandler; | |||
} | |||
|
|||
public int getPageWidth() { | |||
return Integer.valueOf(widthParameter.substring(1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a bit of a hack, but it's the easiest way to do this at the moment. in the future, should just provide the actual width.
@@ -25,7 +24,7 @@ | |||
|
|||
@ActivityScope | |||
public class CoordinatesModel { | |||
private static final int PIXEL_THRESHOLD = 10; | |||
private static final float THRESHOLD_PERCENTAGE = 0.015f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.5% of the page width
@@ -141,7 +174,7 @@ private AyahCoordinates normalizePageAyahs(AyahCoordinates ayahCoordinates) { | |||
if (lastRect.left < firstRect.right) { | |||
RectF middleBounds = new RectF(lastRect.left, | |||
/* top= */ firstRect.bottom, | |||
firstRect.right, | |||
Math.min(firstRect.right, lastRect.right), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of just taking firstRect.right
, take the left most one. this fixes where the lines are drawn in very rare cases (like 1:7).
This patch fixes highlight overlapping by removing rectangles that
overlap each other. It also changes the threshold of considering a line
to be a "full line" to be a percentage of the page size, which should
help fix some cases where the highlighting on the left or right side
does not form a straight vertical line. Fixes #951.