Skip to content

Commit

Permalink
optimize translation balloon ui
Browse files Browse the repository at this point in the history
(cherry picked from commit ab6f828)
  • Loading branch information
YiiGuxing committed Dec 27, 2021
1 parent dba9854 commit 4894fa2
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -513,22 +513,23 @@ abstract class TranslationPane<T : JComponent>(

private fun updateExtraViewer(translation: Translation?) {
val viewer = extraViewer
val wrapper = extraComponent
viewer.document.clear()

var hasExtraContent = false
if (translation != null) {
translation.dictDocument?.let {
hasExtraContent = true
viewer.apply(it)
}
for (extraDocument in translation.extraDocuments) {
hasExtraContent = true
viewer.append(extraDocument)
}
viewer.isVisible = true
wrapper.isVisible = true
} else {
viewer.isVisible = false
wrapper.isVisible = false
}

viewer.caretPosition = 0
viewer.isVisible = hasExtraContent
extraComponent.isVisible = hasExtraContent
}

private fun Viewer.updateText(text: String?) {
Expand Down

0 comments on commit 4894fa2

Please sign in to comment.