@@ -42,20 +42,88 @@ cameras.show = function (id, code, displayName, userColor, userFont) {
4242 cameras . hide ( id ) ;
4343 }
4444 var cameraVideo = { } ;
45+ var transitionAnim = null ;
46+ var back = false ;
4547 var elms = createCameraVideoDiv ( ( ) => {
4648 var div = elms . div ;
4749 var fullScreenDiv = elms . fullScreenDiv ;
50+ if ( transitionAnim ) {
51+ transitionAnim . cancel ( ) ;
52+ if ( back ) {
53+ div . remove ( ) ;
54+ fullScreenDiv . remove ( ) ;
55+ cameraVideosDiv . append ( div ) ;
56+ }
57+ }
58+ back = false ;
4859 if ( div . hasAttribute ( "fullscreen" ) ) {
60+ //Calculate estimated position.
4961 div . remove ( ) ;
5062 fullScreenDiv . remove ( ) ;
5163 cameraVideosDiv . append ( div ) ;
5264 div . removeAttribute ( "fullscreen" ) ;
65+ var bounding = div . getBoundingClientRect ( ) ;
66+ div . remove ( ) ;
67+ fullScreenDiv . remove ( ) ;
68+ document . body . append ( fullScreenDiv ) ;
69+ document . body . append ( div ) ;
70+ //Animate
71+ transitionAnim = div . animate (
72+ [
73+ {
74+ width : "calc(100vw - 100px)" ,
75+ height : "calc(100vh - 100px)" ,
76+ position : "fixed" ,
77+ top : "50%" ,
78+ left : "50%" ,
79+ transform : "translate(-50%, -50%)" ,
80+ zIndex : "9999999" ,
81+ fontSize : "30px" ,
82+ } ,
83+ {
84+ width : "150px" ,
85+ height : "150px" ,
86+ position : "fixed" ,
87+ top : bounding . top + "px" ,
88+ left : bounding . left + "px" ,
89+ } ,
90+ ] ,
91+ {
92+ duration : 300 ,
93+ easing : "ease-out" ,
94+ }
95+ ) ;
96+ back = true ;
97+ transitionAnim . onfinish = function ( ) {
98+ div . remove ( ) ;
99+ fullScreenDiv . remove ( ) ;
100+ cameraVideosDiv . append ( div ) ;
101+ } ;
53102 } else {
103+ var bounding = div . getBoundingClientRect ( ) ;
54104 div . remove ( ) ;
55105 fullScreenDiv . remove ( ) ;
56106 document . body . append ( fullScreenDiv ) ;
57107 document . body . append ( div ) ;
58108 div . setAttribute ( "fullscreen" , "" ) ;
109+ transitionAnim = div . animate (
110+ [
111+ {
112+ position : "fixed" ,
113+ top : bounding . top + "px" ,
114+ left : bounding . left + "px" ,
115+ transform : "translate(0%, 0%)" ,
116+ fontSize : "13px" ,
117+ width : "150px" ,
118+ height : "150px" ,
119+ } ,
120+ { } ,
121+ ] ,
122+ {
123+ duration : 300 ,
124+ easing : "ease-out" ,
125+ }
126+ ) ;
59127 }
60128 } ) ;
61129 cameraVideo . elms = elms ;
0 commit comments