mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 17:59:33 +02:00
Merge branch 'master' of github.com:ybereza/FBReaderJ into highlighting
This commit is contained in:
commit
b89c253c13
1 changed files with 18 additions and 4 deletions
|
@ -889,6 +889,7 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
||||||
for (int wordIndex = info.RealStartElementIndex; wordIndex != endElementIndex && index < to; ++wordIndex, charIndex = 0) {
|
for (int wordIndex = info.RealStartElementIndex; wordIndex != endElementIndex && index < to; ++wordIndex, charIndex = 0) {
|
||||||
final ZLTextElement element = paragraph.getElement(wordIndex);
|
final ZLTextElement element = paragraph.getElement(wordIndex);
|
||||||
final ZLTextElementArea area = page.TextElementMap.get(index);
|
final ZLTextElementArea area = page.TextElementMap.get(index);
|
||||||
|
final ZLTextElementArea toarea = page.TextElementMap.get(to - 1);
|
||||||
if (element == area.Element) {
|
if (element == area.Element) {
|
||||||
++index;
|
++index;
|
||||||
if (area.ChangeStyle) {
|
if (area.ChangeStyle) {
|
||||||
|
@ -897,10 +898,23 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
||||||
final int areaX = area.XStart;
|
final int areaX = area.XStart;
|
||||||
final int areaY = area.YEnd - getElementDescent(element) - getTextStyle().getVerticalAlign(metrics());
|
final int areaY = area.YEnd - getElementDescent(element) - getTextStyle().getVerticalAlign(metrics());
|
||||||
if (element instanceof ZLTextWord) {
|
if (element instanceof ZLTextWord) {
|
||||||
|
boolean hlword = false;
|
||||||
|
for (ZLTextHighlighting hilite : myHighlightings) {
|
||||||
|
if (hilite.intersects(page)) {
|
||||||
|
final ZLTextElementArea hiliteStartArea = hilite.getStartArea(page);
|
||||||
|
final ZLTextElementArea hiliteEndArea = hilite.getEndArea(page);
|
||||||
|
if (hiliteStartArea != null && hiliteEndArea != null &&
|
||||||
|
(hiliteStartArea.compareTo(toarea) <= 0) &&
|
||||||
|
(hiliteEndArea.compareTo(area) >= 0)) {
|
||||||
|
hlword = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hlword = hlword || mySelection.isAreaSelected(area);
|
||||||
drawWord(
|
drawWord(
|
||||||
areaX, areaY, (ZLTextWord)element, charIndex, -1, false,
|
areaX, areaY, (ZLTextWord)element, charIndex, -1, false, hlword ?
|
||||||
mySelection.isAreaSelected(area)
|
getSelectionForegroundColor() : getTextColor(getTextStyle().Hyperlink)
|
||||||
? getSelectionForegroundColor() : getTextColor(getTextStyle().Hyperlink)
|
|
||||||
);
|
);
|
||||||
} else if (element instanceof ZLTextImageElement) {
|
} else if (element instanceof ZLTextImageElement) {
|
||||||
final ZLTextImageElement imageElement = (ZLTextImageElement)element;
|
final ZLTextImageElement imageElement = (ZLTextImageElement)element;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue