编辑器粘贴和拖动可撤销

This commit is contained in:
ckcz123 2021-07-20 17:13:46 +08:00
parent fca0d1f01c
commit fe6a162616
2 changed files with 7 additions and 3 deletions

View File

@ -277,6 +277,7 @@ editor_mappanel_wrapper = function (editor) {
// 后续的处理
} else {
// 左键拖拽: 交换
editor.savePreMap();
// editor.movePos(editor.uivalues.startPos, editor.uivalues.endPos);
editor.exchangePos(editor.uivalues.startPos, editor.uivalues.endPos);
editor.uifunctions.unhighlightSaveFloorButton();
@ -640,9 +641,9 @@ editor_mappanel_wrapper = function (editor) {
}
};
bindSpecialDoor.enemys.forEach(function (loc) {
editor.currentFloorData.afterBattle[loc] = [
{"type": "setValue", "name": doorFlag, "operator": "+=", "value": "1"}
]
if (!editor.currentFloorData.afterBattle[loc])
editor.currentFloorData.afterBattle[loc] = [];
editor.currentFloorData.afterBattle[loc].push({"type": "setValue", "name": doorFlag, "operator": "+=", "value": "1"});
});
editor.file.saveFloorFile(function (err) {
if (err) {

View File

@ -222,6 +222,7 @@ editor_ui_wrapper = function (editor) {
}
if (e.ctrlKey && e.keyCode == 88 && !selectBox.isSelected()) {
e.preventDefault();
editor.savePreMap();
editor.uivalues.copyedInfo = editor.copyFromPos(editor.uivalues.selectedArea);
editor.clearPos(true, editor.uivalues.selectedArea, function () {
printf('该点事件已剪切;请注意右键地图拉框可以剪切一个区域;若有时剪切失灵请多点几下空白处');
@ -235,6 +236,7 @@ editor_ui_wrapper = function (editor) {
printe("没有复制的事件");
return;
}
editor.savePreMap();
editor.pasteToPos(editor.uivalues.copyedInfo);
editor.updateMap();
editor.file.saveFloorFile(function (err) {
@ -250,6 +252,7 @@ editor_ui_wrapper = function (editor) {
}
// DELETE
if (e.keyCode == 46 && !selectBox.isSelected()) {
editor.savePreMap();
editor.clearPos(true, editor.uivalues.selectedArea, function () {
printf('该点事件已删除;请注意右键地图拉框可以删除一个区域;;若有时删除失灵请多点几下空白处');
editor.uifunctions.unhighlightSaveFloorButton();