web: Configuration to disable context menu on touch

This commit is contained in:
Daniel Jacobs 2023-05-03 09:36:07 -04:00 committed by relrelb
parent 1908d85f65
commit 68f493336a
3 changed files with 12 additions and 0 deletions

View File

@ -22,6 +22,7 @@ export const DEFAULT_CONFIG: Required<BaseLoadOptions> = {
logLevel: LogLevel.Error,
showSwfDownload: false,
contextMenu: true,
touchContextMenu: true,
// Backwards-compatibility option
preloader: true,
splashScreen: true,

View File

@ -338,6 +338,14 @@ export interface BaseLoadOptions {
*/
contextMenu?: boolean;
/**
* Whether or not to show a context menu when long-pressing
* a Ruffle instance on touch devices.
*
* @default true
*/
touchContextMenu?: boolean;
/**
* Whether or not to show a splash screen before the SWF has loaded with Ruffle (backwards-compatibility).
*

View File

@ -1335,6 +1335,9 @@ export class RufflePlayer extends HTMLElement {
if (
(this.loadedConfig && this.loadedConfig.contextMenu === false) ||
(this.isTouch &&
this.loadedConfig &&
this.loadedConfig.touchContextMenu === false) ||
this.contextMenuForceDisabled
) {
return;