PluginProbe
Smart Forms – when you need more than just a contact form / trunk
Smart Forms – when you need more than just a contact form vtrunk
trunk 0.5 0.5.5 0.6 0.7 0.8 0.8.5 0.9.1
smart-forms / js / tutorials2 / SmartTutorial / Slide.ts

Slide.ts in Smart Forms – when you need more than just a contact form trunk, at js/tutorials2/SmartTutorial/Slide.ts

66 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import {ActionBase} from "./Actions/ActionBase";
2 import {SmartTutorial} from "./SmartTutorial";
3 import {HighlightAction} from "./Actions/HighlightAction";
4 declare let rnJQuery:JQueryStatic;
5 export class Slide{
6 private actionList:ActionBase[]=[];
7 public tutorial:SmartTutorial;
8 public currentAction:ActionBase;
9 public currentActionIndex:number;
10 private highlights:HighlightAction[]=[];
11 constructor()
12 {
13
14 }
15
16 public AddAction(action:ActionBase)
17 {
18 this.actionList.push(action);
19 if(action instanceof HighlightAction)
20 this.highlights.push(action);
21 return this;
22 }
23
24
25
26 private async ExecuteNextAction() {
27 this.currentActionIndex++;
28 if(this.actionList.length==this.currentActionIndex)
29 this.Finish();
30 else
31 {
32 this.currentAction=this.actionList[this.currentActionIndex];
33 this.currentAction.tutorial=this.tutorial;
34 await this.currentAction.Execute();
35 this.ExecuteNextAction();
36 }
37
38 }
39
40 Clear(nextSlide: Slide) {
41 for(let action of this.actionList) {
42 let preventClear=false;
43 action.ClearTooltips();
44 if (action instanceof HighlightAction&&nextSlide!=null)
45 for (let nextHighlights of nextSlide.highlights)
46 if (action.$target[0] == nextHighlights.$target[0]) {
47 nextHighlights.previousStyle=action.previousStyle;
48 preventClear = true;
49 }
50 if(!preventClear)
51 action.Clear();
52
53
54 }
55
56 }
57
58 Execute() {
59 this.currentActionIndex=-1;
60 this.ExecuteNextAction();
61 }
62
63 private Finish() {
64
65 }
66 }