engine
engine copied to clipboard
Canvas default action will be block
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.