From 44efc51729aef9729d38fc38dce58760fc6cb607 Mon Sep 17 00:00:00 2001 From: Raanan Weber Date: Tue, 13 Apr 2021 21:14:06 +0200 Subject: [PATCH] reformatting Former-commit-id: 6d1e08da7662e3736edf86162b99e29ef576fcfe --- .prettierrc | 2 +- src/Inputs/scene.inputManager.ts | 65 +++++++++++++++++++++++++++----- 2 files changed, 57 insertions(+), 10 deletions(-) diff --git a/.prettierrc b/.prettierrc index 16241ac1399..a84a2f1d472 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,5 @@ { "trailingComma": "es5", "tabWidth": 4, - "printWidth": 300 + "printWidth": 180 } diff --git a/src/Inputs/scene.inputManager.ts b/src/Inputs/scene.inputManager.ts index b846c587cd8..ae0497114c7 100644 --- a/src/Inputs/scene.inputManager.ts +++ b/src/Inputs/scene.inputManager.ts @@ -70,7 +70,12 @@ export class InputManager { private _onPointerDown: (evt: IPointerEvent) => void; private _onPointerUp: (evt: IPointerEvent) => void; - private _initClickEvent: (obs1: Observable, obs2: Observable, evt: IPointerEvent, cb: (clickInfo: _ClickInfo, pickResult: Nullable) => void) => void; + private _initClickEvent: ( + obs1: Observable, + obs2: Observable, + evt: IPointerEvent, + cb: (clickInfo: _ClickInfo, pickResult: Nullable) => void + ) => void; private _initActionManager: (act: Nullable, clickInfo: _ClickInfo) => Nullable; private _delayedSimpleClick: (btn: number, clickInfo: _ClickInfo, cb: (clickInfo: _ClickInfo, pickResult: Nullable) => void) => void; private _delayedSimpleClickTimeout: number; @@ -304,7 +309,15 @@ export class InputManager { var pickResult = scene.pick( this._unTranslatedPointerX, this._unTranslatedPointerY, - (mesh: AbstractMesh): boolean => (mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.actionManager && mesh.actionManager.hasSpecificTrigger(Constants.ACTION_OnLongPressTrigger) && mesh === this._pickedDownMesh), + (mesh: AbstractMesh): boolean => + ( + (mesh.isPickable && + mesh.isVisible && + mesh.isReady() && + mesh.actionManager && + mesh.actionManager.hasSpecificTrigger(Constants.ACTION_OnLongPressTrigger) && + mesh === this._pickedDownMesh) + ), false, scene.cameraToUseForPointers ); @@ -341,7 +354,10 @@ export class InputManager { /** @hidden */ public _isPointerSwiping(): boolean { - return Math.abs(this._startingPointerPosition.x - this._pointerX) > InputManager.DragMovementThreshold || Math.abs(this._startingPointerPosition.y - this._pointerY) > InputManager.DragMovementThreshold; + return ( + Math.abs(this._startingPointerPosition.x - this._pointerX) > InputManager.DragMovementThreshold || + Math.abs(this._startingPointerPosition.y - this._pointerY) > InputManager.DragMovementThreshold + ); } /** @@ -497,7 +513,12 @@ export class InputManager { } }; - this._initClickEvent = (obs1: Observable, obs2: Observable, evt: IPointerEvent, cb: (clickInfo: _ClickInfo, pickResult: Nullable) => void): void => { + this._initClickEvent = ( + obs1: Observable, + obs2: Observable, + evt: IPointerEvent, + cb: (clickInfo: _ClickInfo, pickResult: Nullable) => void + ): void => { let clickInfo = new _ClickInfo(); this._currentPickResult = null; let act: Nullable = null; @@ -619,7 +640,13 @@ export class InputManager { this._updatePointerPosition(evt as IPointerEvent); // PreObservable support - if (this._checkPrePointerObservable(null, evt as IPointerEvent, evt.type === "wheel" || evt.type === "mousewheel" || evt.type === "DOMMouseScroll" ? PointerEventTypes.POINTERWHEEL : PointerEventTypes.POINTERMOVE)) { + if ( + this._checkPrePointerObservable( + null, + evt as IPointerEvent, + evt.type === "wheel" || evt.type === "mousewheel" || evt.type === "DOMMouseScroll" ? PointerEventTypes.POINTERWHEEL : PointerEventTypes.POINTERMOVE + ) + ) { return; } @@ -677,7 +704,13 @@ export class InputManager { if (!scene.pointerDownPredicate) { scene.pointerDownPredicate = (mesh: AbstractMesh): boolean => { - return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.isEnabled() && (!scene.cameraToUseForPointers || (scene.cameraToUseForPointers.layerMask & mesh.layerMask) !== 0); + return ( + mesh.isPickable && + mesh.isVisible && + mesh.isReady() && + mesh.isEnabled() && + (!scene.cameraToUseForPointers || (scene.cameraToUseForPointers.layerMask & mesh.layerMask) !== 0) + ); }; } @@ -743,7 +776,13 @@ export class InputManager { if (!scene.pointerUpPredicate) { scene.pointerUpPredicate = (mesh: AbstractMesh): boolean => { - return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.isEnabled() && (!scene.cameraToUseForPointers || (scene.cameraToUseForPointers.layerMask & mesh.layerMask) !== 0); + return ( + mesh.isPickable && + mesh.isVisible && + mesh.isReady() && + mesh.isEnabled() && + (!scene.cameraToUseForPointers || (scene.cameraToUseForPointers.layerMask & mesh.layerMask) !== 0) + ); }; } @@ -808,7 +847,9 @@ export class InputManager { const ctrlKey = isKeyboardActive && this._deviceInputSystem.pollInput(DeviceType.Keyboard, 0, Constants.INPUT_CTRL_KEY) === 1; const metaKey = isKeyboardActive && - (this._deviceInputSystem.pollInput(DeviceType.Keyboard, 0, Constants.INPUT_META_KEY1) === 1 || this._deviceInputSystem.pollInput(DeviceType.Keyboard, 0, Constants.INPUT_META_KEY2) === 1 || this._deviceInputSystem.pollInput(DeviceType.Keyboard, 0, Constants.INPUT_META_KEY3) === 1); + (this._deviceInputSystem.pollInput(DeviceType.Keyboard, 0, Constants.INPUT_META_KEY1) === 1 || + this._deviceInputSystem.pollInput(DeviceType.Keyboard, 0, Constants.INPUT_META_KEY2) === 1 || + this._deviceInputSystem.pollInput(DeviceType.Keyboard, 0, Constants.INPUT_META_KEY3) === 1); const shiftKey = isKeyboardActive && this._deviceInputSystem.pollInput(DeviceType.Keyboard, 0, Constants.INPUT_SHIFT_KEY) === 1; const evt: { [k: string]: any } = {}; @@ -878,7 +919,13 @@ export class InputManager { } if (attachMove) { - if (inputIndex === PointerInput.Horizontal || inputIndex === PointerInput.Vertical || inputIndex === PointerInput.DeltaHorizontal || inputIndex === PointerInput.DeltaVertical || inputIndex === PointerInput.FakeMove) { + if ( + inputIndex === PointerInput.Horizontal || + inputIndex === PointerInput.Vertical || + inputIndex === PointerInput.DeltaHorizontal || + inputIndex === PointerInput.DeltaVertical || + inputIndex === PointerInput.FakeMove + ) { evt.type = "pointermove"; let currentEvent = eventData || evt;