Skip to content

Start to code parent blocks #105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions iwsy/iwsy.js
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ const IWSY = (player, text) => {
block.element = null;
}
}
player.innerHTML = null;
script.steps.forEach((step, index) => {
step.index = index;
if (typeof step.label !== `undefined`) {
Expand Down
50 changes: 41 additions & 9 deletions iwsy/resources/ecs/blocks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
div Row
div Cell
div Empty
input PropertyValue
input PropertyInput
select BlockSelect
button EditButton
button SaveButton
img ShowBlock
Expand All @@ -21,14 +22,18 @@
variable Blocks
variable Block
variable Block2
variable BlockNames
variable ParentBlock
variable Defaults
variable PropertyDefaults
variable PropertyNames
variable PropertyName
variable SelectedBlock
variable SavedIndex
variable Parent
variable Message
variable N
variable M
variable NBlocks

put -1 into SelectedBlock
Expand Down Expand Up @@ -162,7 +167,7 @@ Restart:
put element SelectedBlock of Blocks into Block
put property `defaults` of Block into Defaults
put the json count of PropertyNames into N
set the elements of PropertyValue to N
set the elements of PropertyInput to N
put 0 into N
while N is less than the json count of PropertyNames
begin
Expand All @@ -172,10 +177,33 @@ Restart:
create Cell in Row
set the style of Cell to `width:8em;padding-left:0.5em`
set the content of Cell to PropertyName
index PropertyValue to N
create PropertyValue in Row
set the style of PropertyValue to `flex:1`
set the text of PropertyValue to property PropertyName of Defaults
if PropertyName is `parent`
begin
put property PropertyName of Defaults into Parent
set BlockNames to array
json add `` to BlockNames
put 0 into M
while M is less than the json count of Blocks
begin
if M is not SelectedBlock
begin
put element M of Blocks into ParentBlock
put property `defaults` of ParentBlock into Defaults
json add property `name` of Defaults to BlockNames
end
add 1 to M
end
create BlockSelect in Row
set the style of BlockSelect to `flex:1;height:1.5em`
set BlockSelect from BlockNames as Parent
end
else
begin
index PropertyInput to N
create PropertyInput in Row
set the style of PropertyInput to `flex:1;height:1.5em`
set the text of PropertyInput to property PropertyName of Defaults
end
add 1 to N
end
create Row in Editor
Expand Down Expand Up @@ -221,9 +249,13 @@ SaveSelectedBlock:
while N is less than the json count of PropertyNames
begin
put element N of PropertyNames into PropertyName
index PropertyValue to N
set property PropertyName of Defaults to the text of PropertyValue
add 1 to N
if PropertyName is `parent` set property PropertyName of Defaults to BlockSelect
else
begin
index PropertyInput to N
set property PropertyName of Defaults to the text of PropertyInput
end
add 1 to N
end
set the text of EditButton to property `name` of Defaults
set property `defaults` of Block to Defaults
Expand Down
4 changes: 2 additions & 2 deletions iwsy/resources/json/demo.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"background": "",
"border": "",
"borderRadius": "",
"fontColor": "#ffffff",
"fontColor": "#ccffff",
"fontFamily": "",
"fontSize": 40,
"fontStyle": "",
Expand Down Expand Up @@ -188,7 +188,7 @@
"title": "My demo presentation",
"action": "init",
"label": "",
"aspect ratio": "16:9",
"aspect ratio": "160:89",
"background": "",
"border": ""
},
Expand Down
1 change: 1 addition & 0 deletions iwsy/resources/json/propertyDefaults.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "New block",
"parent": "",
"left": 0,
"top": 0,
"width": "100%",
Expand Down
1 change: 1 addition & 0 deletions iwsy/resources/json/propertyNames.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[
"name",
"parent",
"left",
"top",
"width",
Expand Down
82 changes: 45 additions & 37 deletions iwsy/resources/json/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"fontColor": "",
"textAlign": "",
"textMarginLeft": "",
"textMarginTop": ""
"textMarginTop": "",
"parent": ""
}
},
{
Expand All @@ -37,7 +38,8 @@
"fontColor": "",
"textAlign": "",
"textMarginLeft": "",
"textMarginTop": ""
"textMarginTop": "",
"parent": ""
}
},
{
Expand All @@ -57,7 +59,8 @@
"fontColor": "#dddd88",
"textAlign": "center",
"textMarginLeft": "",
"textMarginTop": ""
"textMarginTop": "",
"parent": ""
}
},
{
Expand All @@ -68,7 +71,7 @@
"borderRadius": "",
"fontColor": "#dddd88",
"fontFamily": "",
"fontSize": 80,
"fontSize": 70,
"fontStyle": "",
"fontWeight": "",
"height": 300,
Expand All @@ -77,7 +80,8 @@
"textMarginLeft": "",
"textMarginTop": "",
"top": 300,
"width": "100%"
"width": "100%",
"parent": ""
}
},
{
Expand All @@ -86,43 +90,45 @@
"background": "",
"border": "",
"borderRadius": "",
"fontColor": "#ffffff",
"fontColor": "#ccffff",
"fontFamily": "",
"fontSize": 50,
"fontSize": 40,
"fontStyle": "",
"fontWeight": "",
"height": 220,
"left": 0,
"textAlign": "center",
"textMarginLeft": "",
"textMarginTop": "",
"top": 30,
"width": "100%"
"top": 20,
"width": "100%",
"parent": ""
}
},
{
"defaults": {
"name": "main content",
"left": 50,
"top": 250,
"width": 900,
"height": 700,
"background": "",
"border": "",
"background": "rgba(80,80,80,0.5)",
"border": "1px solid white",
"borderRadius": "",
"fontColor": "yellow",
"fontFamily": "",
"fontSize": 50,
"fontWeight": "",
"fontStyle": "",
"fontColor": "yellow",
"textAlign": "",
"fontWeight": "",
"height": 700,
"left": 50,
"textAlign": "left",
"textMarginLeft": 20,
"textMarginTop": 20
"textMarginTop": 20,
"top": 250,
"width": 900,
"parent": ""
}
},
{
"defaults": {
"name": "left",
"name": "main content left",
"background": "rgba(80,80,80,0.5)",
"border": "1px solid white",
"borderRadius": "",
Expand All @@ -133,16 +139,17 @@
"fontWeight": "",
"height": 700,
"left": 50,
"textAlign": "",
"textAlign": "left",
"textMarginLeft": 20,
"textMarginTop": 20,
"top": 250,
"width": 400
"width": 400,
"parent": "main content"
}
},
{
"defaults": {
"name": "right",
"name": "main content right",
"background": "rgba(80,80,80,0.5)",
"border": "1px solid white",
"borderRadius": "",
Expand All @@ -153,15 +160,20 @@
"fontWeight": "",
"height": 700,
"left": 550,
"textAlign": "",
"textAlign": "left",
"textMarginLeft": 20,
"textMarginTop": 20,
"top": 250,
"width": 400
"width": 400,
"parent": "main content"
}
}
],
"content": [
{
"name": "blank",
"content": ""
},
{
"name": "a new dawn",
"content": "# A new dawn is coming..."
Expand All @@ -172,23 +184,19 @@
},
{
"name": "page 1 left",
"content": "### PowerPoint%0a%0a - is slide-based%0a - is a PC application%0a - is hard to embed%0a%0aPowerPoint is organized mainly around static text blocks and tied to the desktop."
"content": "### PowerPoint%0a%0a - is slide-based%0a - is a PC application%0a - is hard to embed%0a%0aPowerPoint is organized mainly around static text blocks and is tied to the desktop."
},
{
"name": "page 1 right",
"content": "### I Wanna Show You%0a - is step based%0a - runs in your browser%0a - is fully embeddable%0a%0aIWannaShowYou is built to handle color, movement and the online environment."
},
{
"name": "blank",
"content": ""
}
],
"steps": [
{
"title": "My demo presentation",
"action": "init",
"label": "",
"aspect ratio": "16:9",
"aspect ratio": "160:89",
"background": "",
"border": ""
},
Expand All @@ -210,11 +218,11 @@
"content": "a new dawn"
},
{
"block": "left",
"block": "main content left",
"content": "page 1 left"
},
{
"block": "right",
"block": "main content right",
"content": "page 1 right"
}
]
Expand Down Expand Up @@ -262,7 +270,7 @@
"title": "Wait 3 seconds",
"action": "pause",
"label": "",
"duration": 1
"duration": 3
},
{
"title": "Change title",
Expand All @@ -274,7 +282,7 @@
},
{
"title": "Wait 1 second",
"action": "hold",
"action": "pause",
"label": "",
"duration": 1
},
Expand All @@ -297,8 +305,8 @@
"action": "fade up",
"label": "",
"blocks": [
"left",
"right"
"main content left",
"main content right"
],
"duration": 1
}
Expand Down