mirror of
				https://github.com/tobspr/shapez.io.git
				synced 2025-06-13 13:04:03 +00:00 
			
		
		
		
	use MouseEvent in keybind change hooks
This commit is contained in:
		
							parent
							
								
									e58c2fd371
								
							
						
					
					
						commit
						79dcd79734
					
				@ -86,6 +86,16 @@ for (const categoryId in KEYMAPPINGS) {
 | 
			
		||||
 */
 | 
			
		||||
export function getStringForKeyCode(code) {
 | 
			
		||||
    switch (code) {
 | 
			
		||||
        case 0:
 | 
			
		||||
            return "LMB";
 | 
			
		||||
        case 1:
 | 
			
		||||
            return "MMB";
 | 
			
		||||
        case 2:
 | 
			
		||||
            return "RMB";
 | 
			
		||||
        case 3:
 | 
			
		||||
            return "MB4";
 | 
			
		||||
        case 4:
 | 
			
		||||
            return "MB5";
 | 
			
		||||
        case 8:
 | 
			
		||||
            return "⌫";
 | 
			
		||||
        case 9:
 | 
			
		||||
 | 
			
		||||
@ -121,9 +121,24 @@ export class KeybindingsState extends TextualGameState {
 | 
			
		||||
            this.updateKeybindings();
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        dialog.inputReciever.backButton.add(() => {});
 | 
			
		||||
        const clickListener = event => {
 | 
			
		||||
            console.log(event);
 | 
			
		||||
            if (event.target.tagName == "BUTTON") {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            event.preventDefault();
 | 
			
		||||
            const keyCode = event.button;
 | 
			
		||||
 | 
			
		||||
            this.app.settings.updateKeybindingOverride(id, keyCode);
 | 
			
		||||
 | 
			
		||||
            this.dialogs.closeDialog(dialog);
 | 
			
		||||
            this.updateKeybindings();
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        dialog.inputReciever.backButton.add(() => {});
 | 
			
		||||
        this.dialogs.internalShowDialog(dialog);
 | 
			
		||||
        dialog.element.onmousedown = clickListener;
 | 
			
		||||
 | 
			
		||||
        this.app.sound.playUiSound(SOUNDS.dialogOk);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user