@@ -105,38 +105,40 @@ const IWSY = (container, script) => {
105105 block . element = element ;
106106 element . style [ `position` ] = `absolute` ;
107107 element . style [ `opacity` ] = `0.0` ;
108- let val = properties . blockLeft ;
108+ let val = properties . left ;
109109 if ( ! isNaN ( val ) ) {
110110 val *= w ;
111111 }
112112 element . style [ `left` ] = val ;
113- val = properties . blockTop ;
113+ val = properties . top ;
114114 if ( ! isNaN ( val ) ) {
115115 val *= h ;
116116 }
117117 element . style [ `top` ] = val ;
118- val = properties . blockWidth ;
118+ val = properties . width ;
119119 if ( ! isNaN ( val ) ) {
120- val *= w ;
120+ val = ` ${ val * w } px` ;
121121 }
122- element . style [ `width` ] = ` ${ val } px` ;
123- val = properties . blockHeight ;
122+ element . style [ `width` ] = val ;
123+ val = properties . height ;
124124 if ( ! isNaN ( val ) ) {
125- val *= h ;
125+ val = ` ${ val * h } px` ;
126126 }
127- element . style [ `height` ] = ` ${ val } px` ;
128- element . style [ `background` ] = properties . blockBackground ;
129- element . style [ `border` ] = properties . blockBorder ;
127+ element . style [ `height` ] = val ;
128+ element . style [ `background` ] = properties . background ;
129+ element . style [ `border` ] = properties . border ;
130130 container . appendChild ( element ) ;
131131 val = properties . textMarginLeft ;
132132 if ( ! isNaN ( val ) ) {
133- val *= w ;
133+ val = ` ${ val * w } px` ;
134134 }
135+ element . style [ `width` ] = val ;
135136 const marginLeft = val ;
136137 val = properties . textMarginTop ;
137138 if ( ! isNaN ( val ) ) {
138- val *= h ;
139+ val = ` ${ val * h } px` ;
139140 }
141+ element . style [ `height` ] = val ;
140142 const marginTop = val ;
141143 const inner = document . createElement ( `div` ) ;
142144 inner . style [ `position` ] = `absolute` ;
@@ -176,30 +178,30 @@ const IWSY = (container, script) => {
176178 block . element = element ;
177179 element . style [ `position` ] = `absolute` ;
178180 element . style [ `opacity` ] = `0.0` ;
179- let val = properties . blockLeft ;
181+ let val = properties . left ;
180182 if ( ! isNaN ( val ) ) {
181183 val *= w ;
182184 }
183185 element . style [ `left` ] = val ;
184- val = properties . blockTop ;
186+ val = properties . top ;
185187 if ( ! isNaN ( val ) ) {
186188 val *= h ;
187189 }
188190 element . style [ `top` ] = val ;
189191 element . style [ `top` ] = val ;
190- val = properties . blockWidth ;
192+ val = properties . width ;
191193 if ( ! isNaN ( val ) ) {
192- val *= w ;
194+ val = ` ${ val * w } px` ;
193195 }
194- element . style [ `width` ] = ` ${ val } px` ;
195- val = properties . blockHeight ;
196+ element . style [ `width` ] = val ;
197+ val = properties . height ;
196198 if ( ! isNaN ( val ) ) {
197- val *= h ;
199+ val = ` ${ val * h } px` ;
198200 }
199- element . style [ `height` ] = ` ${ val } px` ;
200- element . style [ `background` ] = properties . blockBackground ;
201- element . style [ `border` ] = properties . blockBorder ;
202- element . style [ `border-radius` ] = properties . blockBorderRadius ;
201+ element . style [ `height` ] = val ;
202+ element . style [ `background` ] = properties . background ;
203+ element . style [ `border` ] = properties . border ;
204+ element . style [ `border-radius` ] = properties . borderRadius ;
203205 container . appendChild ( element ) ;
204206 if ( script . speed === `scan` ) {
205207 element . style . opacity = 0 ;
@@ -634,6 +636,13 @@ const IWSY = (container, script) => {
634636 }
635637 } ;
636638
639+ // Go to a specified step number
640+ const gotoStep = ( target ) => {
641+ script . scanTarget = target ;
642+ script . singleStep = true ;
643+ scan ( ) ;
644+ } ;
645+
637646 // Load a plugin action
638647 const load = step => {
639648 if ( script . speed === `scan` ) {
@@ -652,7 +661,7 @@ const IWSY = (container, script) => {
652661 }
653662 } ;
654663
655- // Initialize the presenttion
664+ // Initialize the presentation
656665 const init = step => {
657666 if ( step . title ) {
658667 document . title = step . title ;
@@ -677,6 +686,16 @@ const IWSY = (container, script) => {
677686 step . next ( ) ;
678687 } ;
679688
689+ // Chain to another presentation
690+ const chain = step => {
691+ step . next ( )
692+ } ;
693+
694+ // Embed another presentation
695+ const embed = step => {
696+ step . next ( )
697+ } ;
698+
680699 const actions = {
681700 init,
682701 setcontent,
@@ -689,7 +708,9 @@ const IWSY = (container, script) => {
689708 crossfade,
690709 transition,
691710 goto,
692- load
711+ load,
712+ chain,
713+ embed
693714 } ;
694715
695716 // Process a single step
@@ -734,6 +755,7 @@ const IWSY = (container, script) => {
734755 container . style . cursor = 'none' ;
735756 container . style [ `background-size` ] = `cover` ;
736757 script . speed = `normal` ;
758+ script . singleStep = true ;
737759 script . labels = { } ;
738760 for ( const [ index , step ] of script . steps . entries ( ) ) {
739761 step . index = index ;
@@ -743,10 +765,14 @@ const IWSY = (container, script) => {
743765 }
744766 if ( index < script . steps . length - 1 ) {
745767 step . next = ( ) => {
746- const next = step . index + 1 ;
747- setTimeout ( ( ) => {
748- doStep ( script . steps [ next ] ) ;
749- } , 0 ) ;
768+ if ( script . singleStep && script . speed != `scan` ) {
769+ console . log ( `Single-step` ) ;
770+ } else {
771+ const next = step . index + 1 ;
772+ setTimeout ( ( ) => {
773+ doStep ( script . steps [ next ] ) ;
774+ } , 0 ) ;
775+ }
750776 }
751777 }
752778 else {
@@ -760,4 +786,5 @@ const IWSY = (container, script) => {
760786 initBlocks ( ) ;
761787 preloadImages ( ) ;
762788 doStep ( script . steps [ 0 ] ) ;
789+ return gotoStep ;
763790} ;
0 commit comments