engine icon indicating copy to clipboard operation
engine copied to clipboard

Canvas default action will be block

Open gz65555 opened this issue 2 years ago • 0 comments

Describe the bug Canvas touch action has been blocked by PointerManager.

If a canvas has been inserted in a html, user can not scroll the page by touching the canvas because we set default action in PointerManager.ts.

Expected behavior User can scroll the page by touching the canvas.

Additional context The code in PointerManager.ts:

constructor(engine: Engine, htmlCanvas: HTMLCanvasElement) {
    this._engine = engine;
    this._canvas = engine.canvas;
    this._htmlCanvas = htmlCanvas;
    htmlCanvas.style.touchAction = "none";
    htmlCanvas.oncontextmenu = (event: UIEvent) => {
      return false;
    };
    ...
  }

Default action should be called in game template.

And the convention code is

<canvas style="touch-action: auto;" contextmenu=""></canvas>

The code in PointerManager will break the convention.

gz65555 avatar Jul 18 '22 09:07 gz65555