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

Fix highlight overlapping #1098

Merged
merged 1 commit into from
Mar 15, 2019
Merged

Fix highlight overlapping #1098

merged 1 commit into from
Mar 15, 2019

Conversation

ahmedre
Copy link
Contributor

@ahmedre ahmedre commented Mar 15, 2019

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.

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));
Copy link
Contributor Author

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;
Copy link
Contributor Author

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),
Copy link
Contributor Author

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).

@ahmedre ahmedre merged commit e015f9a into quran:master Mar 15, 2019
@ahmedre ahmedre deleted the fix_highlighting branch March 15, 2019 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

highligh overlap
1 participant