Move presets into their own panel

This commit is contained in:
MattIPv4
2020-05-05 15:49:42 +01:00
parent e7e9cbcfa2
commit 795edd2255
5 changed files with 129 additions and 62 deletions

View File

@@ -1,12 +1,20 @@
import isChanged from './is_changed';
export default (defaults, cat) => {
export default (defaults, cat, isInteraction = true) => {
return Object.keys(defaults).reduce((prev, key) => {
prev[key] = {
get() {
return this.$props.data[key].value;
},
set (value) {
// Save user interaction if value changed
if (isInteraction
&& this.$parent
&& 'hasUserInteraction' in this.$parent.$data
&& !this.$parent.$data.hasUserInteraction
&& this.$props.data[key].value !== value)
this.$parent.$data.hasUserInteraction = true;
this.$props.data[key].value = value;
this.$props.data[key].computed = value;
},