Skip to content

Commit

Permalink
fix to not incorrectly open quick lexicon in modal
Browse files Browse the repository at this point in the history
  • Loading branch information
patricksptang committed Jun 19, 2024
1 parent d1d9978 commit 25dcdfa
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions step-web/src/main/webapp/js/backbone/views/view_quick_lexicon.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ var QuickLexicon = Backbone.View.extend({
var hasVersePopup = false;
for (var i = versePopupLocations.length -1; i >= 0; i --) {
var versePopupLoc = $(versePopupLocations[i]);
if ((typeof versePopupLoc.position === "function") && (typeof versePopupLoc.position().top === "number")) {
if (versePopupLoc.is(":visible") && (typeof versePopupLoc.position === "function") && (typeof versePopupLoc.position().top === "number")) {
self.position = versePopupLoc.position().top;
hasVersePopup = true;
break;
Expand Down Expand Up @@ -306,15 +306,14 @@ var QuickLexicon = Backbone.View.extend({
}
}
else {
if ((quickDefPositionAtTop) && (bottom > self.position)) {
if ((quickDefPositionAtTop) && (bottom + 20 > self.position)) {
lexicon.css({"top": "", "bottom": "0"});
top = $("#quickLexicon").position().top;
bottom = $("#quickLexicon").outerHeight(true) + top;
quickDefPositionAtTop = false;
top = $("#quickLexicon").position().top; // The top position has changed
bottom = $("#quickLexicon").outerHeight(true) + top; // The bottom position has changed
}
if ((top < -8) || (bottom > self.height + 8) || // The quickLexicon div's top or bottom is not visible
// ((quickDefPositionAtTop) && (bottom > self.position)) || // Overlap with mouse pointer // Already checked a few lines above.
((!quickDefPositionAtTop) && (top < self.position)) ) { // Overlap with mouse pointer
((top < 20) && (bottom > self.position)) || // Quick lexicon is at top. Bottom of quick lexicon overlap mouse pointer
((top > 50) && (top < self.position))) { // Quick lexicon is at bottom. Top of quick lexicon overlap mouse pointer
lexicon.remove();
if (headerText === "Notes") {
if ($(lexicon).find('strong').text() === '▼')
Expand Down

0 comments on commit 25dcdfa

Please sign in to comment.