@@ -105,38 +105,40 @@ const IWSY = (container, script) => {
105
105
block . element = element ;
106
106
element . style [ `position` ] = `absolute` ;
107
107
element . style [ `opacity` ] = `0.0` ;
108
- let val = properties . blockLeft ;
108
+ let val = properties . left ;
109
109
if ( ! isNaN ( val ) ) {
110
110
val *= w ;
111
111
}
112
112
element . style [ `left` ] = val ;
113
- val = properties . blockTop ;
113
+ val = properties . top ;
114
114
if ( ! isNaN ( val ) ) {
115
115
val *= h ;
116
116
}
117
117
element . style [ `top` ] = val ;
118
- val = properties . blockWidth ;
118
+ val = properties . width ;
119
119
if ( ! isNaN ( val ) ) {
120
- val *= w ;
120
+ val = ` ${ val * w } px` ;
121
121
}
122
- element . style [ `width` ] = ` ${ val } px` ;
123
- val = properties . blockHeight ;
122
+ element . style [ `width` ] = val ;
123
+ val = properties . height ;
124
124
if ( ! isNaN ( val ) ) {
125
- val *= h ;
125
+ val = ` ${ val * h } px` ;
126
126
}
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 ;
130
130
container . appendChild ( element ) ;
131
131
val = properties . textMarginLeft ;
132
132
if ( ! isNaN ( val ) ) {
133
- val *= w ;
133
+ val = ` ${ val * w } px` ;
134
134
}
135
+ element . style [ `width` ] = val ;
135
136
const marginLeft = val ;
136
137
val = properties . textMarginTop ;
137
138
if ( ! isNaN ( val ) ) {
138
- val *= h ;
139
+ val = ` ${ val * h } px` ;
139
140
}
141
+ element . style [ `height` ] = val ;
140
142
const marginTop = val ;
141
143
const inner = document . createElement ( `div` ) ;
142
144
inner . style [ `position` ] = `absolute` ;
@@ -176,30 +178,30 @@ const IWSY = (container, script) => {
176
178
block . element = element ;
177
179
element . style [ `position` ] = `absolute` ;
178
180
element . style [ `opacity` ] = `0.0` ;
179
- let val = properties . blockLeft ;
181
+ let val = properties . left ;
180
182
if ( ! isNaN ( val ) ) {
181
183
val *= w ;
182
184
}
183
185
element . style [ `left` ] = val ;
184
- val = properties . blockTop ;
186
+ val = properties . top ;
185
187
if ( ! isNaN ( val ) ) {
186
188
val *= h ;
187
189
}
188
190
element . style [ `top` ] = val ;
189
191
element . style [ `top` ] = val ;
190
- val = properties . blockWidth ;
192
+ val = properties . width ;
191
193
if ( ! isNaN ( val ) ) {
192
- val *= w ;
194
+ val = ` ${ val * w } px` ;
193
195
}
194
- element . style [ `width` ] = ` ${ val } px` ;
195
- val = properties . blockHeight ;
196
+ element . style [ `width` ] = val ;
197
+ val = properties . height ;
196
198
if ( ! isNaN ( val ) ) {
197
- val *= h ;
199
+ val = ` ${ val * h } px` ;
198
200
}
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 ;
203
205
container . appendChild ( element ) ;
204
206
if ( script . speed === `scan` ) {
205
207
element . style . opacity = 0 ;
@@ -634,6 +636,13 @@ const IWSY = (container, script) => {
634
636
}
635
637
} ;
636
638
639
+ // Go to a specified step number
640
+ const gotoStep = ( target ) => {
641
+ script . scanTarget = target ;
642
+ script . singleStep = true ;
643
+ scan ( ) ;
644
+ } ;
645
+
637
646
// Load a plugin action
638
647
const load = step => {
639
648
if ( script . speed === `scan` ) {
@@ -652,7 +661,7 @@ const IWSY = (container, script) => {
652
661
}
653
662
} ;
654
663
655
- // Initialize the presenttion
664
+ // Initialize the presentation
656
665
const init = step => {
657
666
if ( step . title ) {
658
667
document . title = step . title ;
@@ -677,6 +686,16 @@ const IWSY = (container, script) => {
677
686
step . next ( ) ;
678
687
} ;
679
688
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
+
680
699
const actions = {
681
700
init,
682
701
setcontent,
@@ -689,7 +708,9 @@ const IWSY = (container, script) => {
689
708
crossfade,
690
709
transition,
691
710
goto,
692
- load
711
+ load,
712
+ chain,
713
+ embed
693
714
} ;
694
715
695
716
// Process a single step
@@ -734,6 +755,7 @@ const IWSY = (container, script) => {
734
755
container . style . cursor = 'none' ;
735
756
container . style [ `background-size` ] = `cover` ;
736
757
script . speed = `normal` ;
758
+ script . singleStep = true ;
737
759
script . labels = { } ;
738
760
for ( const [ index , step ] of script . steps . entries ( ) ) {
739
761
step . index = index ;
@@ -743,10 +765,14 @@ const IWSY = (container, script) => {
743
765
}
744
766
if ( index < script . steps . length - 1 ) {
745
767
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
+ }
750
776
}
751
777
}
752
778
else {
@@ -760,4 +786,5 @@ const IWSY = (container, script) => {
760
786
initBlocks ( ) ;
761
787
preloadImages ( ) ;
762
788
doStep ( script . steps [ 0 ] ) ;
789
+ return gotoStep ;
763
790
} ;
0 commit comments