|
@@ -38,6 +38,18 @@ export class FreeCameraTouchInput implements ICameraInput<FreeCamera> {
|
|
private _onLostFocus: Nullable<(e: FocusEvent) => any>;
|
|
private _onLostFocus: Nullable<(e: FocusEvent) => any>;
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * Manage the touch inputs to control the movement of a free camera.
|
|
|
|
+ * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs
|
|
|
|
+ * @param allowMouse Defines if mouse events can be treated as touch events
|
|
|
|
+ */
|
|
|
|
+ constructor(
|
|
|
|
+ /**
|
|
|
|
+ * Define if mouse events can be treated as touch events
|
|
|
|
+ */
|
|
|
|
+ public allowMouse = false) {
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* Attach the input controls to a specific dom element to get the input from.
|
|
* Attach the input controls to a specific dom element to get the input from.
|
|
* @param element Defines the element the controls should be listened from
|
|
* @param element Defines the element the controls should be listened from
|
|
* @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
|
|
* @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
|
|
@@ -55,7 +67,7 @@ export class FreeCameraTouchInput implements ICameraInput<FreeCamera> {
|
|
var evt = <PointerEvent>p.event;
|
|
var evt = <PointerEvent>p.event;
|
|
|
|
|
|
let isMouseEvent = evt instanceof MouseEvent;
|
|
let isMouseEvent = evt instanceof MouseEvent;
|
|
- if (evt.pointerType === "mouse" || isMouseEvent) {
|
|
|
|
|
|
+ if (!this.allowMouse && (evt.pointerType === "mouse" || isMouseEvent)) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|