|
@@ -6,6 +6,7 @@ import HistoryEvents from "../enum/HistoryEvents";
|
|
|
import { historyService } from "../Service/HistoryService";
|
|
|
import { textService } from "../Service/TextService";
|
|
|
import { roadService } from "../Service/RoadService";
|
|
|
+import { svgService } from "../Service/SVGService";
|
|
|
import { roadPointService } from "../Service/RoadPointService";
|
|
|
import { lineService } from "../Service/LineService";
|
|
|
import { circleService } from "../Service/CircleService";
|
|
@@ -96,7 +97,7 @@ export default class History {
|
|
|
this.goPreForLines(item.lines);
|
|
|
this.goPreForCircles(item.circles);
|
|
|
this.goPreForTexts(item.texts);
|
|
|
-
|
|
|
+ this.goPreForSVGs(item.svgs);
|
|
|
historyService.undoHistoryRecord();
|
|
|
change.saveCurrentInfo();
|
|
|
this.setState();
|
|
@@ -181,6 +182,22 @@ export default class History {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ goPreForSVGs(itemForSVGs) {
|
|
|
+ for (let i = 0; i < itemForSVGs.length; ++i) {
|
|
|
+ const item = itemForSVGs[i];
|
|
|
+ if (item.handle == HistoryEvents.AddSVG) {
|
|
|
+ dataService.deleteSVG(item.svg.id);
|
|
|
+ } else if (item.handle == HistoryEvents.DeleteSVG) {
|
|
|
+ let newSVG = svgService.create(item.svg.center, item.svg.id);
|
|
|
+ historyUtil.assignSVGFromSVG(newSVG, item.svg);
|
|
|
+ } else if (item.handle == HistoryEvents.ModifySVG) {
|
|
|
+ const preSVG = item.preSVG;
|
|
|
+ let currentSVG = dataService.getSVG(item.curSVG.id);
|
|
|
+ historyUtil.assignSVGFromSVG(currentSVG, preSVG);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
goNextForPoints(itemForPoints) {
|
|
|
for (let i = 0; i < itemForPoints.length; ++i) {
|
|
|
const item = itemForPoints[i];
|
|
@@ -256,6 +273,22 @@ export default class History {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ goNextForSVGs(itemForSVGs) {
|
|
|
+ for (let i = 0; i < itemForSVGs.length; ++i) {
|
|
|
+ const item = itemForSVGs[i];
|
|
|
+ if (item.handle == HistoryEvents.AddSVG) {
|
|
|
+ let vSVG = svgService.create(item.svg.center, item.svg.id);
|
|
|
+ historyUtil.assignSVGFromSVG(vSVG, item.svg);
|
|
|
+ } else if (item.handle == HistoryEvents.DeleteSVG) {
|
|
|
+ dataService.deleteSVG(item.svg.id);
|
|
|
+ } else if (item.handle == HistoryEvents.ModifySVG) {
|
|
|
+ const currentSVG = item.curSVG;
|
|
|
+ let preSVG = dataService.getSVG(item.curSVG.id);
|
|
|
+ historyUtil.assignSVGFromSVG(preSVG, currentSVG);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 恢复
|
|
|
goNextState() {
|
|
|
historyService.redoHistoryRecord();
|
|
@@ -267,6 +300,7 @@ export default class History {
|
|
|
this.goNextForLines(item.lines);
|
|
|
this.goNextForCircles(item.circles);
|
|
|
this.goNextForTexts(item.texts);
|
|
|
+ this.goNextForSVGs(item.svgs);
|
|
|
change.saveCurrentInfo();
|
|
|
this.setState();
|
|
|
} else {
|