1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2026-08-05 15:29:17 +08:00

#136 save seedLayout settings

This commit is contained in:
lana-k
2026-04-06 20:31:51 +02:00
parent c0d972c2ab
commit 4cc6ec86ea
7 changed files with 32 additions and 17 deletions

View File

@@ -5,7 +5,7 @@
:value="modelValue.initialAlgorithm"
:clearable="false"
className="test_fa2_initial_layout_algorithm_select"
@change="update('initialAlgorithm', $event)"
@change="updateInitialAlgorithm"
/>
</Field>
@@ -51,14 +51,34 @@ export default {
layoutSettingsComponentMap: markRaw({
random: RandomLayoutSettings,
circlepack: CirclePackLayoutSettings
})
}),
defaultSeedLayoutSettings: {
circular: { initialAlgorithm: 'circular' },
random: { initialAlgorithm: 'random', seedValue: 1 },
circlepack: {
initialAlgorithm: 'circlepack',
hierarchyAttributes: [],
seedValue: 1
}
}
}
},
methods: {
update(attributeName, value) {
updateInitialAlgorithm(newAlgorithm) {
const newSettings = {
...this.modelValue
}
const prevAlgorithmSettings =
this.defaultSeedLayoutSettings[this.modelValue.initialAlgorithm]
Object.keys(prevAlgorithmSettings).forEach(key => {
delete newSettings[key]
prevAlgorithmSettings[key] = this.modelValue[key]
})
this.$emit('update:modelValue', {
...this.modelValue,
[attributeName]: value
...newSettings,
...this.defaultSeedLayoutSettings[newAlgorithm]
})
}
}