Sorry, we don't support your browser.  Install a modern browser
This post is closed.

Setting, clearing, then setting the same PDF highlight does not work.#270

Highlights don’t reappear if you set the same highlight you just cleared.

function onPickUp()
  self.Book.setHighlight(0.2, 0.2, 0.8, 0.8)
end

function onDrop()
  self.Book.clearHighlight()
end

This code will show the highlight on the first pick-up, but not on subsequent pick-ups unless the highlight is set to something different first (ie. by another part of code or by the user clicking and dragging)

If I had to guess, under the hood, setHighlight() is skipped if there’s already a highlight in the exact same spot, and clearHighlight() makes the highlight invisible without actually updating where it is, so setHighlight() sees there’s already a highlight exactly where it wants to go, and skips itself without realizing the old highlight is invisible.

3 years ago

My workaround:
Use self.Book.setHighlight(2, 2, 2, 2) instead of self.Book.clearHighlight(), which just places the highlight offscreen

3 years ago
B
Changed the status to
In Progress
3 years ago
Changed the status to
Completed
3 years ago