Tweaked how the Escape key works.

master
Pacman Ghost 3 years ago
parent 9e8ab3094e
commit fe8ef25735
  1. 20
      asl_rulebook2/webapp/static/MainApp.js
  2. 7
      asl_rulebook2/webapp/static/NavPane.js

@ -185,19 +185,17 @@ gMainApp.component( "main-app", {
},
onEscapePressed() {
// check if an image is currently zoomed
if ( $(".jquery-image-zoom").length > 0 ) {
// yup - no need to do anything (the image will un-zoom itself)
// check if there are any notification balloons open
if ( $( ".growl" ).length > 0 ) {
// yup - close them all
$( ".growl-close" ).each( function() {
$(this).trigger( "click" ) ;
} ) ;
return ;
}
// close any notification balloons
let isFootnoteOpen = $( ".growl-footnote" ).length > 0 ;
$( ".growl-close" ).each( function() {
$(this).trigger( "click" ) ;
} ) ;
// check if a footnotes balloon is open
if ( isFootnoteOpen ) {
// yup - let it "consume" the Escape key
// check if an image is currently zoomed
if ( $(".jquery-image-zoom").length > 0 ) {
// yup - no need to do anything here, the image will un-zoom itself
return ;
}
// check if the rule info popup is open

@ -48,13 +48,6 @@ gMainApp.component( "nav-pane", {
} ) ;
} ) ;
// close the rule info popup if Escape is pressed
gEventBus.on( "escape-pressed", () => {
if ( $( ".growl-footnote" ).length > 0 )
return ; // nb: unless a footnote on-screen (let the Escape close that instead)
this.closeRuleInfo() ;
} ) ;
},
methods: {

Loading…
Cancel
Save