Improved the keyboard interface in the TURN TRACK dialog.

master
Pacman Ghost 2 years ago
parent 4629b3421b
commit 6d261032be
  1. 2
      vasl_templates/webapp/data/default-template-pack/turn_track.j2
  2. 19
      vasl_templates/webapp/static/turn_track.js

@ -42,7 +42,7 @@ body { user-select: none ; }
{% if TURN_TRACK_PREVIEW_MODE %}
<script>
// notify the parent window of a click on a reinforcement flag
// notify the parent window of clicks
function onFlagClick( turnNo, playerNo ) {
window.parent.postMessage( {
type: "FlagClick",

@ -130,7 +130,11 @@ function editTurnTrackSettings()
// FUDGE! This works around a weird problem when we load a scenario with a vertical turn track
// and show it in a turn track dialog that was previously showing a horizontal turn track :-/
updateLayout() ;
} ) ;
// forward key-presses from the <iframe> to us
$( $(this)[0].contentWindow.document ).keydown( function( evt ) {
$dlg.trigger( evt ) ;
} ) ;
} );
return params ;
}
@ -264,7 +268,18 @@ function editTurnTrackSettings()
else if ( evt.data.type === "ShadingClick" )
onShadingClick( evt.data.turnNo ) ;
} ) ;
// handle auto-dismiss
$(this).on( "keydown", function( evt ) {
if ( evt.keyCode == $.ui.keyCode.ENTER && evt.ctrlKey ) {
if ( evt.shiftKey )
$( ".ui-dialog.turn-track button.snippet" ).trigger( "click" ) ;
$(this).find( "select" ).select2( "close" ) ;
evt.preventDefault() ;
evt.stopPropagation() ;
$dlg.dialog( "close" ) ;
return ;
}
} ) ;
},
open: function() {
// initialize the dialog

Loading…
Cancel
Save