소스 검색

Merge pull request #1326 from RaananW/deviceorientation-orientationChanged-fix

calling orientationChanged on attachControl.
David Catuhe 9 년 전
부모
커밋
a071d99a3a
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      src/Cameras/Inputs/babylon.freecamera.input.deviceorientation.ts

+ 3 - 0
src/Cameras/Inputs/babylon.freecamera.input.deviceorientation.ts

@@ -28,6 +28,9 @@ module BABYLON {
         attachControl(element: HTMLElement, noPreventDefault?: boolean) {
             window.addEventListener("orientationchange", this._orientationChanged);
             window.addEventListener("deviceorientation", this._deviceOrientation);
+            //In certain cases, the attach control is called AFTER orientation was changed,
+            //So this is needed.
+            this._orientationChanged();
         }
 
         private _orientationChanged = () => {