|
@@ -27,6 +27,7 @@ import { SpeedyPromise } from 'speedy-vision/types/core/speedy-promise';
|
27
|
27
|
import { Nullable } from '../utils/utils';
|
28
|
28
|
import { Resolution } from '../utils/resolution';
|
29
|
29
|
import { Utils } from '../utils/utils';
|
|
30
|
+import { SessionMode } from './session';
|
30
|
31
|
import { HUD, HUDContainer } from './hud';
|
31
|
32
|
import { FullscreenButton } from '../ui/fullscreen-button';
|
32
|
33
|
import { AREvent, AREventTarget, AREventListener } from '../utils/ar-events';
|
|
@@ -847,6 +848,7 @@ export class Viewport extends ViewportEventTarget
|
847
|
848
|
/**
|
848
|
849
|
* Set viewport style
|
849
|
850
|
*/
|
|
851
|
+ /*
|
850
|
852
|
set style(value: ViewportStyle)
|
851
|
853
|
{
|
852
|
854
|
// note: the viewport style is independent of the session mode!
|
|
@@ -855,6 +857,7 @@ export class Viewport extends ViewportEventTarget
|
855
|
857
|
this._style = value;
|
856
|
858
|
}
|
857
|
859
|
}
|
|
860
|
+ */
|
858
|
861
|
|
859
|
862
|
/**
|
860
|
863
|
* HUD
|
|
@@ -955,12 +958,32 @@ export class Viewport extends ViewportEventTarget
|
955
|
958
|
|
956
|
959
|
/**
|
957
|
960
|
* Initialize the viewport (when the session starts)
|
|
961
|
+ * @param getMediaSize
|
|
962
|
+ * @param sessionMode
|
958
|
963
|
* @internal
|
959
|
964
|
*/
|
960
|
|
- _init(getMediaSize: ViewportSizeGetter): void
|
|
965
|
+ _init(getMediaSize: ViewportSizeGetter, sessionMode: SessionMode): void
|
961
|
966
|
{
|
|
967
|
+ // validate if the viewport style matches the session mode
|
|
968
|
+ if(sessionMode == 'immersive') {
|
|
969
|
+ if(this._style != 'best-fit' && this._style != 'stretch') {
|
|
970
|
+ Utils.warning(`Invalid viewport style \"${this._style}\" for the \"${sessionMode}\" mode`);
|
|
971
|
+ this._style = 'best-fit';
|
|
972
|
+ this._resizer.setStrategyByName(this._style);
|
|
973
|
+ }
|
|
974
|
+ }
|
|
975
|
+ else if(sessionMode == 'inline') {
|
|
976
|
+ if(this._style != 'inline') {
|
|
977
|
+ Utils.warning(`Invalid viewport style \"${this._style}\" for the \"${sessionMode}\" mode`);
|
|
978
|
+ this._style = 'inline';
|
|
979
|
+ this._resizer.setStrategyByName(this._style);
|
|
980
|
+ }
|
|
981
|
+ }
|
|
982
|
+
|
|
983
|
+ // set the media size getter
|
962
|
984
|
this._mediaSize = getMediaSize;
|
963
|
985
|
|
|
986
|
+ // initialize the components
|
964
|
987
|
this._containers.init();
|
965
|
988
|
this._hud._init(HUD_ZINDEX);
|
966
|
989
|
this._canvases.init();
|