mirror of
https://github.com/lana-k/sqliteviz.git
synced 2026-05-06 20:09:18 +08:00
#136 save seedLayout settings
This commit is contained in:
@@ -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]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -791,7 +791,6 @@ export default {
|
||||
const sensibleSettings = forceAtlas2.default.inferSettings(this.graph)
|
||||
this.settings.layout.options = {
|
||||
initialAlgorithm: 'circular',
|
||||
seedValue: 1,
|
||||
initialIterationsAmount: 50,
|
||||
adjustSizes: false,
|
||||
barnesHutOptimize: false,
|
||||
|
||||
@@ -24,7 +24,6 @@ export default {
|
||||
inquiry.viewOptions.layout.type === 'forceAtlas2'
|
||||
) {
|
||||
inquiry.viewOptions.layout.options.initialAlgorithm = 'circular'
|
||||
inquiry.viewOptions.layout.options.seedValue = 1
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user