@@ -7,8 +7,8 @@ const IWSY = (playerElement, scriptObject) => {
7
7
let afterRun ;
8
8
let path ;
9
9
let plugins ;
10
- const timeouts = [ ] ;
11
- const intervals = [ ] ;
10
+ let timeouts = [ ] ;
11
+ let intervals = [ ] ;
12
12
13
13
// Set up all the blocks
14
14
const setupBlocks = ( ) => {
@@ -162,6 +162,9 @@ const IWSY = (playerElement, scriptObject) => {
162
162
}
163
163
const vfxElements = block . textPanel . getElementsByClassName ( `iwsy-vfx` ) ;
164
164
// Save all the vfx items in this step
165
+ if ( ! Array . isArray ( script . vfxElements ) ) {
166
+ script . vfxElements = [ ] ;
167
+ }
165
168
for ( const vfxElement of vfxElements ) {
166
169
script . vfxElements . push ( {
167
170
block,
@@ -216,6 +219,9 @@ const IWSY = (playerElement, scriptObject) => {
216
219
} ;
217
220
218
221
addIntervalTimer = ( interval ) => {
222
+ if ( ! Array . isArray ( intervals ) ) {
223
+ intervals = [ ] ;
224
+ }
219
225
intervals . push ( interval ) ;
220
226
} ;
221
227
@@ -225,8 +231,11 @@ const IWSY = (playerElement, scriptObject) => {
225
231
intervals . splice ( pos , 1 ) ;
226
232
} ;
227
233
228
- addTimeoutTimer = ( interval ) => {
229
- intervals . push ( interval ) ;
234
+ addTimeoutTimer = ( timeout ) => {
235
+ if ( ! Array . isArray ( timeouts ) ) {
236
+ timeouts = [ ] ;
237
+ }
238
+ timeouts . push ( timeout ) ;
230
239
} ;
231
240
232
241
clearAllTimers = ( ) => {
@@ -325,6 +334,9 @@ const IWSY = (playerElement, scriptObject) => {
325
334
const vfx = script . vfx ;
326
335
for ( const item of vfx ) {
327
336
if ( item . name === slide ) {
337
+ if ( ! Array . isArray ( step . vfxRunning ) ) {
338
+ step . vfxRunning = [ ] ;
339
+ }
328
340
step . vfxRunning . push ( vfxElement ) ;
329
341
doPanzoom ( vfxElement , item , ( ) => {
330
342
if ( step . continue !== `yes` ) {
@@ -660,13 +672,19 @@ const IWSY = (playerElement, scriptObject) => {
660
672
if ( colon > 0 ) {
661
673
const aspectW = aspect . substr ( 0 , colon ) ;
662
674
const aspectH = aspect . substr ( colon + 1 ) ;
663
- const height = Math . round ( parseFloat ( player . offsetWidth ) * aspectH / aspectW ) ;
664
- player . style . height = `${ Math . round ( height ) } px` ;
675
+ if ( document . fullscreenElement ) {
676
+ player . style . width = window . innerWidth ;
677
+ player . style . height = window . innerHeight ;
678
+ player . style . border = `` ;
679
+ } else {
680
+ const height = Math . round ( parseFloat ( player . offsetWidth ) * aspectH / aspectW ) ;
681
+ player . style . height = `${ Math . round ( height ) } px` ;
682
+ player . style . border = step . border ;
683
+ }
665
684
}
666
685
player . style . position = `relative` ;
667
686
player . style . overflow = `hidden` ;
668
687
player . style . cursor = `none` ;
669
- player . style . border = step . border ;
670
688
if ( step . background ) {
671
689
player . style . background = step . background . split ( `"` ) . join ( `"` ) ;
672
690
}
@@ -882,6 +900,7 @@ const IWSY = (playerElement, scriptObject) => {
882
900
script . speed = `normal` ;
883
901
script . labels = { } ;
884
902
script . stop = false ;
903
+ script . vfxElements = [ ] ;
885
904
removeStyles ( ) ;
886
905
for ( const block of script . blocks ) {
887
906
const element = block . element ;
@@ -921,7 +940,6 @@ const IWSY = (playerElement, scriptObject) => {
921
940
}
922
941
} ) ;
923
942
setupBlocks ( ) ;
924
- script . vfxElements = [ ] ;
925
943
} ;
926
944
927
945
const actions = {
@@ -985,6 +1003,7 @@ const IWSY = (playerElement, scriptObject) => {
985
1003
986
1004
const actionName = step . action . split ( ` ` ) . join ( `` ) ;
987
1005
let handler = actions [ actionName ] ;
1006
+ step . vfxRunning = [ ] ;
988
1007
if ( script . runMode === `auto` ) {
989
1008
if ( typeof handler === `undefined` ) {
990
1009
handler = plugins [ actionName ] ;
@@ -995,7 +1014,6 @@ const IWSY = (playerElement, scriptObject) => {
995
1014
if ( onStepCB ) {
996
1015
onStepCB ( step . index ) ;
997
1016
}
998
- step . vfxRunning = [ ] ;
999
1017
try {
1000
1018
handler ( step ) ;
1001
1019
} catch ( err ) {
0 commit comments