mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 13:41:03 +00:00 
			
		
		
		
	[HTML5] Handle contextmenu, webglcontextlost internally.
This way they are automatically cleaned up when the engine exits, landing a hand to browsers garbage collectors.
This commit is contained in:
		
							parent
							
								
									9fb27eba8d
								
							
						
					
					
						commit
						8c9a503bde
					
				
					 4 changed files with 14 additions and 11 deletions
				
			
		|  | @ -619,6 +619,18 @@ const GodotDisplay = { | |||
| 		GodotDisplayListeners.add(canvas, 'drop', GodotDisplayDragDrop.handler(dropFiles)); | ||||
| 	}, | ||||
| 
 | ||||
| 	godot_js_display_setup_canvas__sig: 'v', | ||||
| 	godot_js_display_setup_canvas: function () { | ||||
| 		const canvas = GodotConfig.canvas; | ||||
| 		GodotDisplayListeners.add(canvas, 'contextmenu', function (ev) { | ||||
| 			ev.preventDefault(); | ||||
| 		}, false); | ||||
| 		GodotDisplayListeners.add(canvas, 'webglcontextlost', function (ev) { | ||||
| 			alert('WebGL context lost, please reload the page'); // eslint-disable-line no-alert
 | ||||
| 			ev.preventDefault(); | ||||
| 		}, false); | ||||
| 	}, | ||||
| 
 | ||||
| 	/* | ||||
| 	 * Gamepads | ||||
| 	 */ | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Fabio Alessandrelli
						Fabio Alessandrelli