Skip to content

Commit

Permalink
fix: shows missing macro parameters (fluidd-core#566)
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Lamas <[email protected]>
Co-authored-by: Mathis Mensing <[email protected]>
  • Loading branch information
pedrolamas and matmen committed Jun 27, 2022
1 parent dafa085 commit 82e264c
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/components/ui/AppMacroBtn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,15 @@ export default class AppMacroBtn extends Mixins(StateMixin) {
mounted () {
if (!this.macro.config || !this.macro.config.gcode) return []
if (this.macro.config.gcode) {
const regex = /params\.(\w+).*\|\s*default\s*\(\s*([^,)]+)/gmi
let match = regex.exec(this.macro.config.gcode)
do {
if (match && match[1]) {
const name = match[1]
const value = (match[2] || '').trim()
if (!this.params[name]) {
this.$set(this.params, name, { value, reset: value })
}
for (const [, name, rest] of this.macro.config.gcode.matchAll(/params\.(\w+)(.*)/gi)) {
const valueMatch = /\|\s*default\s*\(\s*([^,)]+)/i.exec(rest)
const value = ((valueMatch && valueMatch[1]) || '').trim()
if (!this.params[name]) {
this.$set(this.params, name, { value, reset: value })
}
} while (
(match = regex.exec(this.macro.config.gcode)) !== null
)
}
}
}
}
Expand Down

0 comments on commit 82e264c

Please sign in to comment.