This commit is contained in:
ZaneYork 2020-10-26 10:39:14 +08:00
parent fe0a81b9be
commit de55fe7a1c
1 changed files with 15 additions and 9 deletions

View File

@ -32,8 +32,7 @@
</v-layer> </v-layer>
<v-layer v-if="!isEmpty(currentButtonId)"> <v-layer v-if="!isEmpty(currentButtonId)">
<v-rect :config="getButtonConfig(currentButton, 'lightcyan')" ref="currentButtonRect"></v-rect> <v-rect :config="getButtonConfig(currentButton, 'lightcyan')" ref="currentButtonRect"></v-rect>
<v-text :config="getTextConfig(currentButton, firstNotEmpty(currentButton.alias, currentButton.key))" <v-text :config="getTextConfig(currentButton, firstNotEmpty(currentButton.alias, currentButton.key))"></v-text>
ref="currentButtonText"></v-text>
</v-layer> </v-layer>
</v-stage> </v-stage>
<el-drawer <el-drawer
@ -160,6 +159,7 @@
drawer: false, drawer: false,
landscape: false, landscape: false,
currentButtonId: '', currentButtonId: '',
cachedCurrentButtonId: '',
currentButton: { currentButton: {
key: '', key: '',
alias: '', alias: '',
@ -372,13 +372,9 @@
event.cancelBubble = true; event.cancelBubble = true;
}, },
onActivated: function (button) { onActivated: function (button) {
if (this.isEmpty(this.currentButtonId)) { if (this.currentButtonId !== this.cachedCurrentButtonId && this.$refs.currentButtonRect != null) {
this.$nextTick(() => { this.$refs.currentButtonRect.getNode().cache();
this.$nextTick(() => { this.cachedCurrentButtonId = this.currentButtonId;
this.$refs.currentButtonRect.getNode().cache();
this.$refs.currentButtonText.getNode().cache();
});
});
} }
this.currentButton = button; this.currentButton = button;
this.currentButtonId = button.id; this.currentButtonId = button.id;
@ -473,6 +469,16 @@
// //
isEmpty: function (obj) { isEmpty: function (obj) {
return typeof obj == "undefined" || obj == null || obj === ""; return typeof obj == "undefined" || obj == null || obj === "";
},
saveHistory: function (newConfig) {
this.configHistory[this.configIndex + 1] = this.deepCopy(newConfig);
this.configIndex++;
},
revoke: function () {
this.configIndex--;
},
redo: function () {
this.configIndex++;
} }
} }
} }