|
@@ -7,9 +7,12 @@ import { historyService } from "./Service/HistoryService";
|
|
|
import UIControl from "./Controls/UIControl";
|
|
|
// import { moveRectangle } from "./Controls/MoveRectangle";
|
|
|
import { moveText } from "./Controls/MoveText";
|
|
|
+import { moveSVG } from "./Controls/MoveSVG";
|
|
|
import { addRoad } from "./Controls/AddRoad";
|
|
|
import { addLine } from "./Controls/AddLine";
|
|
|
import { addCircle } from "./Controls/AddCircle";
|
|
|
+import { addText } from "./Controls/AddText";
|
|
|
+import { addSVG } from "./Controls/AddSVG";
|
|
|
import { moveRoad } from "./Controls/MoveRoad";
|
|
|
import { coordinate } from "./Coordinate";
|
|
|
import Render from "./Renderer/Render";
|
|
@@ -125,6 +128,24 @@ export default class Layer {
|
|
|
stateService.setEventName(LayerEvents.AddingCircle);
|
|
|
addCircle.setCenter(position);
|
|
|
break;
|
|
|
+ case LayerEvents.AddText:
|
|
|
+ stateService.setEventName(LayerEvents.MoveText);
|
|
|
+ addText.buildText();
|
|
|
+ stateService.setSelectItem(
|
|
|
+ addText.newText.vectorId,
|
|
|
+ VectorType.Text,
|
|
|
+ SelectState.Select
|
|
|
+ );
|
|
|
+ break;
|
|
|
+ case LayerEvents.AddSVG:
|
|
|
+ stateService.setEventName(LayerEvents.MoveSVG);
|
|
|
+ addSVG.buildSVG();
|
|
|
+ stateService.setSelectItem(
|
|
|
+ addSVG.newSVG.vectorId,
|
|
|
+ VectorType.SVG,
|
|
|
+ SelectState.Select
|
|
|
+ );
|
|
|
+ break;
|
|
|
}
|
|
|
stateService.setDraggingItem(selectItem);
|
|
|
// 清除上一个状态
|
|
@@ -455,26 +476,16 @@ export default class Layer {
|
|
|
}
|
|
|
needAutoRedraw = true;
|
|
|
break;
|
|
|
- case LayerEvents.AddText:
|
|
|
+ case LayerEvents.MoveText:
|
|
|
needAutoRedraw = true;
|
|
|
- if (draggingItem == null) {
|
|
|
- const text = textService.create(position);
|
|
|
- if (text.vectorId) {
|
|
|
- stateService.setSelectItem(
|
|
|
- text.vectorId,
|
|
|
- VectorType.Text,
|
|
|
- SelectState.Select
|
|
|
- );
|
|
|
- stateService.setDraggingItem(stateService.selectItem);
|
|
|
- }
|
|
|
- } else {
|
|
|
+ if (draggingItem != null) {
|
|
|
moveText.moveFullText(position, draggingItem.vectorId);
|
|
|
}
|
|
|
break;
|
|
|
- case LayerEvents.MoveText:
|
|
|
+ case LayerEvents.MoveSVG:
|
|
|
needAutoRedraw = true;
|
|
|
if (draggingItem != null) {
|
|
|
- moveText.moveFullText(position, draggingItem.vectorId);
|
|
|
+ moveSVG.moveFullSVG(position, draggingItem.vectorId);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
@@ -602,9 +613,16 @@ export default class Layer {
|
|
|
this.history.save();
|
|
|
elementService.hideAll();
|
|
|
break;
|
|
|
- // case LayerEvents.AddCurveRoad:
|
|
|
- // addRoad.setNewRoadPoint("start", position);
|
|
|
- // break;
|
|
|
+ case LayerEvents.MoveText:
|
|
|
+ needAutoRedraw = true;
|
|
|
+ this.history.save();
|
|
|
+ elementService.hideAll();
|
|
|
+ break;
|
|
|
+ case LayerEvents.MoveSVG:
|
|
|
+ needAutoRedraw = true;
|
|
|
+ this.history.save();
|
|
|
+ elementService.hideAll();
|
|
|
+ break;
|
|
|
case LayerEvents.AddingCurveRoad:
|
|
|
needAutoRedraw = true;
|
|
|
if (addRoad.canAdd) {
|
|
@@ -637,13 +655,6 @@ export default class Layer {
|
|
|
needAutoRedraw = true;
|
|
|
this.history.save();
|
|
|
break;
|
|
|
- case LayerEvents.MoveText:
|
|
|
- needAutoRedraw = true;
|
|
|
- if (focusItem != null && focusItem.type == VectorType.Text) {
|
|
|
- this.uiControl.currentUI = focusItem.type;
|
|
|
- }
|
|
|
- this.history.save();
|
|
|
- break;
|
|
|
}
|
|
|
|
|
|
this.setEventName("mouseUp");
|
|
@@ -875,25 +886,18 @@ export default class Layer {
|
|
|
stateService.setEventName(LayerEvents.MoveCurveLine);
|
|
|
} else if (selectItem.type == VectorType.Circle) {
|
|
|
stateService.setEventName(LayerEvents.MoveCircle);
|
|
|
+ } else if (selectItem.type == VectorType.Text) {
|
|
|
+ stateService.setEventName(LayerEvents.MoveText);
|
|
|
+ } else if (selectItem.type == VectorType.SVG) {
|
|
|
+ stateService.setEventName(LayerEvents.MoveSVG);
|
|
|
}
|
|
|
}
|
|
|
} else if (eventType == "mouseUp") {
|
|
|
- if (eventName == LayerEvents.AddText) {
|
|
|
- //可连续添加
|
|
|
- //stateService.clearEventName()
|
|
|
- }
|
|
|
- // else if (eventName == LayerEvents.AddRoad) {
|
|
|
- // stateService.setEventName(LayerEvents.AddingRoad);
|
|
|
- // }
|
|
|
- else if (eventName == LayerEvents.AddingRoad) {
|
|
|
+ if (eventName == LayerEvents.AddingRoad) {
|
|
|
stateService.setEventName(LayerEvents.AddRoad);
|
|
|
} else if (eventName == LayerEvents.AddingLine) {
|
|
|
stateService.setEventName(LayerEvents.AddLine);
|
|
|
- }
|
|
|
- // else if (eventName == LayerEvents.AddCurveRoad) {
|
|
|
- // stateService.setEventName(LayerEvents.AddingCurveRoad);
|
|
|
- // }
|
|
|
- else if (eventName == LayerEvents.AddingCurveRoad) {
|
|
|
+ } else if (eventName == LayerEvents.AddingCurveRoad) {
|
|
|
stateService.setEventName(LayerEvents.AddCurveRoad);
|
|
|
} else if (eventName == LayerEvents.AddLine) {
|
|
|
stateService.setEventName(LayerEvents.AddingLine);
|