Skip to content
This repository has been archived by the owner on Apr 8, 2021. It is now read-only.

Book.setHighlight() doesn't work if the same highlight was previously cleared #21

Open
nabbydude opened this issue Apr 30, 2020 · 0 comments
Labels
bug Something isn't working lua Lua scripting tts-feature Feature included in TTS, i.e a handzone.

Comments

@nabbydude
Copy link

Describe the bug
Highlights don't reappear if you set the same highlight you just cleared.

To Reproduce

  1. Create a Custom PDF with the following script and pop it out:
    function onPickUp()
      self.Book.setHighlight(0.2, 0.2, 0.8, 0.8)
    end
    
    function onDrop()
      self.Book.clearHighlight()
    end
  2. Pick it up. The highlight should appear.
  3. Put it back down. The highlight should disappear.
  4. Pick it up again. The highlight does not appear.

This bug seems to persist between loads. If the highlight doesn't appear for you the first time either, its probably because that region was highlighted before a reload.

Expected behavior
The highlight should appear again. This behaves as expected when setting different highlight regions with different parameters, this only seems to happen when a highlight is cleared, and then a highlight with the exact same parameters is applied. The same region can be set again if a different highlight is applied by script or by user interaction.

Tabletop Simulator Info (please complete the following information):

  • OS: Windows 10
  • Version: v12.3.5

Known workarounds
The cleanest workaround would be to use setHighlight(2, 2, 2, 2) instead of clearHighlight(). This sets the highlight to a small dot that is always off-screen.

Additional context
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.

@dore0062 dore0062 added bug Something isn't working lua Lua scripting tts-feature Feature included in TTS, i.e a handzone. labels Apr 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working lua Lua scripting tts-feature Feature included in TTS, i.e a handzone.
Projects
None yet
Development

No branches or pull requests

2 participants