Skip to content
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
14 changes: 14 additions & 0 deletions frontend/dynamic_blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,9 @@ Blockly.Blocks.PointStatement = {
domToMutation,

updateShape: function () {
// get current status for recreation after +-
const branchOption = this.getFieldValue('BRANCH_OPTION')

const values = []
for (let i = 0; i < this.inputCount; i++) {
values.push(
Expand Down Expand Up @@ -353,6 +356,10 @@ Blockly.Blocks.PointStatement = {
[Blockly.Msg.RAILBLOCKS_POINT_BRANCH, 'ITEM2']
]
), 'BRANCH_OPTION')

if (branchOption) {
this.setFieldValue(branchOption, 'BRANCH_OPTION')
}
}
}

Expand All @@ -375,6 +382,9 @@ Blockly.Blocks.LightStatement = {
domToMutation,

updateShape: function () {
// get current status for recreation after +-
const lightStatus = this.getFieldValue('LIGHT_STATUS')

const values = []
for (let i = 0; i < this.inputCount; i++) {
values.push(
Expand Down Expand Up @@ -416,5 +426,9 @@ Blockly.Blocks.LightStatement = {
[Blockly.Msg.RAILBLOCKS_LIGHTS_OFF, 'ITEM2']
]
), 'LIGHT_STATUS')

if (lightStatus) {
this.setFieldValue(lightStatus, 'LIGHT_STATUS')
}
}
}
8 changes: 8 additions & 0 deletions frontend/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ export class FieldPlusMinus extends Blockly.Field {
this,
() => {
this.plusButton_.setAttribute('font-weight', '900')
this.plusButton_.setAttribute('stroke', '#E4E4E4')
this.plusButton_.setAttribute('stroke-width', '0.75')
}
)

Expand All @@ -129,6 +131,8 @@ export class FieldPlusMinus extends Blockly.Field {
this,
() => {
this.plusButton_.setAttribute('font-weight', '400')
this.plusButton_.setAttribute('stroke', 'none')
this.plusButton_.setAttribute('stroke-width', '0')
}
)

Expand All @@ -138,6 +142,8 @@ export class FieldPlusMinus extends Blockly.Field {
this,
() => {
this.minusButton_.setAttribute('font-weight', '900')
this.minusButton_.setAttribute('stroke', '#E4E4E4')
this.minusButton_.setAttribute('stroke-width', '0.75')
}
)

Expand All @@ -147,6 +153,8 @@ export class FieldPlusMinus extends Blockly.Field {
this,
() => {
this.minusButton_.setAttribute('font-weight', '400')
this.minusButton_.setAttribute('stroke', 'none')
this.minusButton_.setAttribute('stroke-width', '0')
}
)
}
Expand Down