|
@@ -17,11 +17,9 @@ import { listenLayer } from "./ListenLayer";
|
|
import LayerEvents from "./enum/LayerEvents.js";
|
|
import LayerEvents from "./enum/LayerEvents.js";
|
|
import UIEvents from "./enum/UIEvents.js";
|
|
import UIEvents from "./enum/UIEvents.js";
|
|
import SelectState from "./enum/SelectState.js";
|
|
import SelectState from "./enum/SelectState.js";
|
|
-import Constant from "./Constant";
|
|
|
|
import VectorType from "./enum/VectorType";
|
|
import VectorType from "./enum/VectorType";
|
|
import { mathUtil } from "./Util/MathUtil";
|
|
import { mathUtil } from "./Util/MathUtil";
|
|
import History from "./History/History";
|
|
import History from "./History/History";
|
|
-import { keyService } from "./Service/KeyService";
|
|
|
|
import mitt from "mitt";
|
|
import mitt from "mitt";
|
|
import { roadService } from "./Service/RoadService";
|
|
import { roadService } from "./Service/RoadService";
|
|
|
|
|
|
@@ -105,11 +103,7 @@ export default class Layer {
|
|
else if (eventName == LayerEvents.AddingRoad) {
|
|
else if (eventName == LayerEvents.AddingRoad) {
|
|
let flag = addRoad.setNewRoadPoint(
|
|
let flag = addRoad.setNewRoadPoint(
|
|
"end",
|
|
"end",
|
|
- //elementService.newWall.end,
|
|
|
|
- coordinate.getXYFromScreen({
|
|
|
|
- x: this.startX,
|
|
|
|
- y: this.startY,
|
|
|
|
- }),
|
|
|
|
|
|
+ elementService.newRoad.end,
|
|
listenLayer.modifyPoint
|
|
listenLayer.modifyPoint
|
|
);
|
|
);
|
|
if (!flag) {
|
|
if (!flag) {
|
|
@@ -117,7 +111,11 @@ export default class Layer {
|
|
}
|
|
}
|
|
if (addRoad.canAdd) {
|
|
if (addRoad.canAdd) {
|
|
addRoad.buildRoad();
|
|
addRoad.buildRoad();
|
|
|
|
+ addRoad.clear();
|
|
|
|
+ this.renderer.autoRedraw();
|
|
this.history.save();
|
|
this.history.save();
|
|
|
|
+ stateService.clearEventName();
|
|
|
|
+ elementService.hideAll();
|
|
} else {
|
|
} else {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -126,7 +124,7 @@ export default class Layer {
|
|
if (eventName == null && selectItem) {
|
|
if (eventName == null && selectItem) {
|
|
stateService.setDraggingItem(selectItem);
|
|
stateService.setDraggingItem(selectItem);
|
|
stateService.setFocusItem(selectItem);
|
|
stateService.setFocusItem(selectItem);
|
|
- this.uiControl.showAttributes();
|
|
|
|
|
|
+ //this.uiControl.showAttributes(); //弹出
|
|
this.uiControl.currentUI = selectItem.type;
|
|
this.uiControl.currentUI = selectItem.type;
|
|
} else if (eventName == null) {
|
|
} else if (eventName == null) {
|
|
this.uiControl.currentUI = null;
|
|
this.uiControl.currentUI = null;
|
|
@@ -163,7 +161,7 @@ export default class Layer {
|
|
switch (eventName) {
|
|
switch (eventName) {
|
|
case null:
|
|
case null:
|
|
//监控
|
|
//监控
|
|
- //needAutoRedraw = listenLayer.start(position);
|
|
|
|
|
|
+ needAutoRedraw = listenLayer.start(position);
|
|
break;
|
|
break;
|
|
case LayerEvents.PanBackGround:
|
|
case LayerEvents.PanBackGround:
|
|
stateService.clearItems();
|
|
stateService.clearItems();
|
|
@@ -179,7 +177,7 @@ export default class Layer {
|
|
stateService.clearDraggingItem();
|
|
stateService.clearDraggingItem();
|
|
stateService.clearFocusItem();
|
|
stateService.clearFocusItem();
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
- //listenLayer.start(position);
|
|
|
|
|
|
+ listenLayer.start(position);
|
|
if (listenLayer.modifyPoint) {
|
|
if (listenLayer.modifyPoint) {
|
|
position = {
|
|
position = {
|
|
x: listenLayer.modifyPoint.x,
|
|
x: listenLayer.modifyPoint.x,
|
|
@@ -187,14 +185,14 @@ export default class Layer {
|
|
};
|
|
};
|
|
}
|
|
}
|
|
elementService.execute(null, position);
|
|
elementService.execute(null, position);
|
|
- elementService.setStartAddWall(position);
|
|
|
|
- elementService.showStartAddWall();
|
|
|
|
|
|
+ elementService.setStartAddRoad(position);
|
|
|
|
+ elementService.showStartAddRoad();
|
|
break;
|
|
break;
|
|
case LayerEvents.AddingRoad:
|
|
case LayerEvents.AddingRoad:
|
|
stateService.clearDraggingItem();
|
|
stateService.clearDraggingItem();
|
|
stateService.clearFocusItem();
|
|
stateService.clearFocusItem();
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
- //listenLayer.start(position);
|
|
|
|
|
|
+ listenLayer.start(position);
|
|
let startPosition = {
|
|
let startPosition = {
|
|
x: addRoad.startInfo.position.x,
|
|
x: addRoad.startInfo.position.x,
|
|
y: addRoad.startInfo.position.y,
|
|
y: addRoad.startInfo.position.y,
|
|
@@ -206,42 +204,39 @@ export default class Layer {
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
- // elementService.execute(startPosition, position);
|
|
|
|
- // elementService.setStartAddWall(position);
|
|
|
|
- // if (!elementService.newWall.display) {
|
|
|
|
- // elementService.setNewWall(startPosition, position);
|
|
|
|
- // elementService.showNewWall(); //画墙
|
|
|
|
- // } else {
|
|
|
|
- // if (!listenLayer.modifyPoint && addRoad.startInfo.linkedPointId) {
|
|
|
|
- // let newEndPosition = elementService.checkAngle(
|
|
|
|
- // position,
|
|
|
|
- // addRoad.startInfo.linkedPointId,
|
|
|
|
- // null
|
|
|
|
- // );
|
|
|
|
- // if (newEndPosition) {
|
|
|
|
- // mathUtil.clonePoint(position, newEndPosition);
|
|
|
|
- // elementService.execute(startPosition, position);
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // elementService.setNewWallEndPosition(position); //改变end位置
|
|
|
|
- // }
|
|
|
|
|
|
+ elementService.execute(startPosition, position);
|
|
|
|
+ elementService.setStartAddRoad(position);
|
|
|
|
+ if (!elementService.newRoad.display) {
|
|
|
|
+ elementService.setNewRoad(startPosition, position);
|
|
|
|
+ elementService.showNewRoad();
|
|
|
|
+ } else {
|
|
|
|
+ if (!listenLayer.modifyPoint && addRoad.startInfo.linkedPointId) {
|
|
|
|
+ let newEndPosition = elementService.checkAngle(
|
|
|
|
+ position,
|
|
|
|
+ addRoad.startInfo.linkedPointId,
|
|
|
|
+ null
|
|
|
|
+ );
|
|
|
|
+ if (newEndPosition) {
|
|
|
|
+ mathUtil.clonePoint(position, newEndPosition);
|
|
|
|
+ elementService.execute(startPosition, position);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ elementService.setNewRoadGeoType(VectorType.Road);
|
|
|
|
+ elementService.setNewRoadEndPosition(position); //改变end位置
|
|
|
|
+ }
|
|
|
|
|
|
addRoad.canAdd = addRoad.canAddRoadForEnd(position);
|
|
addRoad.canAdd = addRoad.canAddRoadForEnd(position);
|
|
- // if (!addRoad.canAdd) {
|
|
|
|
- // elementService.setNewWallState("error");
|
|
|
|
- // } else {
|
|
|
|
- // if (this.uiControl.selectUI == UIEvents.OutWall) {
|
|
|
|
- // elementService.setNewWallState("normal-out");
|
|
|
|
- // } else {
|
|
|
|
- // elementService.setNewWallState("normal");
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
|
|
+ if (!addRoad.canAdd) {
|
|
|
|
+ elementService.setNewRoadState("error");
|
|
|
|
+ } else {
|
|
|
|
+ elementService.setNewRoadState("normal");
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
case LayerEvents.MoveRoad:
|
|
case LayerEvents.MoveRoad:
|
|
dx = (dx * coordinate.defaultZoom) / coordinate.zoom;
|
|
dx = (dx * coordinate.defaultZoom) / coordinate.zoom;
|
|
dy = (dy * coordinate.defaultZoom) / coordinate.zoom;
|
|
dy = (dy * coordinate.defaultZoom) / coordinate.zoom;
|
|
// 1表示可以继续移动,2表示不能移动(启动距离还不够),3表示wallId被删除了,4表示重新开始移动(需要达到一定距离才能启动),5表示不能移动(不合适)
|
|
// 1表示可以继续移动,2表示不能移动(启动距离还不够),3表示wallId被删除了,4表示重新开始移动(需要达到一定距离才能启动),5表示不能移动(不合适)
|
|
- let moveFlag = moveRoad.moveWallPlane(draggingItem.vectorId, dx, dy);
|
|
|
|
|
|
+ let moveFlag = moveRoad.moveRoadPlane(draggingItem.vectorId, dx, dy);
|
|
// 启动的时候需要点距离,所以真正移动了才更新lastX和lastY
|
|
// 启动的时候需要点距离,所以真正移动了才更新lastX和lastY
|
|
if (moveFlag == 1) {
|
|
if (moveFlag == 1) {
|
|
this.lastX = X;
|
|
this.lastX = X;
|
|
@@ -251,7 +246,7 @@ export default class Layer {
|
|
// 需要继续保持移动,一般是距离不够启动
|
|
// 需要继续保持移动,一般是距离不够启动
|
|
else if (moveFlag == 2) {
|
|
else if (moveFlag == 2) {
|
|
}
|
|
}
|
|
- // wallId被删除了
|
|
|
|
|
|
+ // roadId被删除了
|
|
else if (moveFlag == 3) {
|
|
else if (moveFlag == 3) {
|
|
this.history.save();
|
|
this.history.save();
|
|
stateService.clearSelectItem();
|
|
stateService.clearSelectItem();
|
|
@@ -260,7 +255,7 @@ export default class Layer {
|
|
listenLayer.clear();
|
|
listenLayer.clear();
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
}
|
|
}
|
|
- // wallId有一端被吸附了,这时候需要重新启动
|
|
|
|
|
|
+ // roadId有一端被吸附了,这时候需要重新启动
|
|
else if (moveFlag == 4) {
|
|
else if (moveFlag == 4) {
|
|
this.lastX = X;
|
|
this.lastX = X;
|
|
this.lastY = Y;
|
|
this.lastY = Y;
|
|
@@ -271,11 +266,10 @@ export default class Layer {
|
|
this.lastX = X;
|
|
this.lastX = X;
|
|
this.lastY = Y;
|
|
this.lastY = Y;
|
|
}
|
|
}
|
|
-
|
|
|
|
break;
|
|
break;
|
|
case LayerEvents.MoveRoadPoint:
|
|
case LayerEvents.MoveRoadPoint:
|
|
let point = dataService.getPoint(draggingItem.vectorId);
|
|
let point = dataService.getPoint(draggingItem.vectorId);
|
|
- //listenLayer.start(position, draggingItem.vectorId, point.parent);
|
|
|
|
|
|
+ listenLayer.start(position, draggingItem.vectorId, point.parent);
|
|
if (listenLayer.modifyPoint) {
|
|
if (listenLayer.modifyPoint) {
|
|
position = {
|
|
position = {
|
|
x: listenLayer.modifyPoint.x,
|
|
x: listenLayer.modifyPoint.x,
|
|
@@ -292,7 +286,7 @@ export default class Layer {
|
|
elementService.hideAll();
|
|
elementService.hideAll();
|
|
} else {
|
|
} else {
|
|
point = dataService.getPoint(draggingItem.vectorId);
|
|
point = dataService.getPoint(draggingItem.vectorId);
|
|
- //listenLayer.start(point, draggingItem.vectorId, point.parent);
|
|
|
|
|
|
+ listenLayer.start(point, draggingItem.vectorId, point.parent);
|
|
let otherPoint = null;
|
|
let otherPoint = null;
|
|
if (
|
|
if (
|
|
listenLayer.modifyPoint &&
|
|
listenLayer.modifyPoint &&
|
|
@@ -321,6 +315,28 @@ export default class Layer {
|
|
}
|
|
}
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
break;
|
|
break;
|
|
|
|
+ case LayerEvents.AddTag:
|
|
|
|
+ needAutoRedraw = true;
|
|
|
|
+ if (draggingItem == null) {
|
|
|
|
+ const tag = tagService.createTag(position);
|
|
|
|
+ if (tag.vectorId) {
|
|
|
|
+ stateService.setSelectItem(
|
|
|
|
+ tag.vectorId,
|
|
|
|
+ VectorType.Tag,
|
|
|
|
+ SelectState.All
|
|
|
|
+ );
|
|
|
|
+ stateService.setDraggingItem(stateService.selectItem);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ moveTag.moveFullTag(position, draggingItem.vectorId);
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case LayerEvents.MoveTag:
|
|
|
|
+ needAutoRedraw = true;
|
|
|
|
+ if (draggingItem != null) {
|
|
|
|
+ moveTag.moveFullTag(position, draggingItem.vectorId);
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
|
|
|
|
if (needAutoRedraw) {
|
|
if (needAutoRedraw) {
|
|
@@ -329,10 +345,6 @@ export default class Layer {
|
|
}
|
|
}
|
|
|
|
|
|
onMouseUp(e) {
|
|
onMouseUp(e) {
|
|
- if (coordinate.defaultCenter == null) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
const X = e.offsetX || e.layerX;
|
|
const X = e.offsetX || e.layerX;
|
|
const Y = e.offsetY || e.layerY;
|
|
const Y = e.offsetY || e.layerY;
|
|
|
|
|
|
@@ -347,7 +359,6 @@ export default class Layer {
|
|
cursor: { x: this.lastX, y: this.lastY },
|
|
cursor: { x: this.lastX, y: this.lastY },
|
|
};
|
|
};
|
|
stateService.setFocusItem(focusItem);
|
|
stateService.setFocusItem(focusItem);
|
|
- this.uiControl.showAttributes();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
let position = coordinate.getXYFromScreen({
|
|
let position = coordinate.getXYFromScreen({
|
|
@@ -355,7 +366,7 @@ export default class Layer {
|
|
y: Y,
|
|
y: Y,
|
|
});
|
|
});
|
|
let needAutoRedraw = false;
|
|
let needAutoRedraw = false;
|
|
- let symbol = null;
|
|
|
|
|
|
+
|
|
switch (eventName) {
|
|
switch (eventName) {
|
|
case null:
|
|
case null:
|
|
return;
|
|
return;
|
|
@@ -369,13 +380,12 @@ export default class Layer {
|
|
elementService.hideAll();
|
|
elementService.hideAll();
|
|
let point = dataService.getPoint(draggingItem.vectorId);
|
|
let point = dataService.getPoint(draggingItem.vectorId);
|
|
if (point) {
|
|
if (point) {
|
|
- //listenLayer.start(point, draggingItem.vectorId, point.parent);
|
|
|
|
-
|
|
|
|
|
|
+ listenLayer.start(point, draggingItem.vectorId, point.parent);
|
|
if (
|
|
if (
|
|
listenLayer.modifyPoint &&
|
|
listenLayer.modifyPoint &&
|
|
listenLayer.modifyPoint.hasOwnProperty("linkedPointId")
|
|
listenLayer.modifyPoint.hasOwnProperty("linkedPointId")
|
|
) {
|
|
) {
|
|
- wallService.moveTo(
|
|
|
|
|
|
+ roadService.moveTo(
|
|
draggingItem.vectorId,
|
|
draggingItem.vectorId,
|
|
listenLayer.modifyPoint.linkedPointId
|
|
listenLayer.modifyPoint.linkedPointId
|
|
);
|
|
);
|
|
@@ -385,25 +395,22 @@ export default class Layer {
|
|
listenLayer.modifyPoint.linkedPointIdY)
|
|
listenLayer.modifyPoint.linkedPointIdY)
|
|
) {
|
|
) {
|
|
mathUtil.clonePoint(point, listenLayer.modifyPoint);
|
|
mathUtil.clonePoint(point, listenLayer.modifyPoint);
|
|
- symbolService.updateSymbolsPositionsForWallCorner(
|
|
|
|
- draggingItem.vectorId
|
|
|
|
- );
|
|
|
|
} else if (
|
|
} else if (
|
|
listenLayer.modifyPoint &&
|
|
listenLayer.modifyPoint &&
|
|
- listenLayer.modifyPoint.hasOwnProperty("linkedWallId")
|
|
|
|
|
|
+ listenLayer.modifyPoint.hasOwnProperty("linkedRoadId")
|
|
) {
|
|
) {
|
|
- point = wallService.createPoint(
|
|
|
|
|
|
+ point = roadService.createPoint(
|
|
listenLayer.modifyPoint.x,
|
|
listenLayer.modifyPoint.x,
|
|
listenLayer.modifyPoint.y
|
|
listenLayer.modifyPoint.y
|
|
);
|
|
);
|
|
- wallService.splitWall(
|
|
|
|
- listenLayer.modifyPoint.linkedWallId,
|
|
|
|
|
|
+ roadService.splitRoad(
|
|
|
|
+ listenLayer.modifyPoint.linkedRoadId,
|
|
point.vectorId,
|
|
point.vectorId,
|
|
"start"
|
|
"start"
|
|
);
|
|
);
|
|
- wallService.moveTo(draggingItem.vectorId, point.vectorId);
|
|
|
|
|
|
+ roadService.moveTo(draggingItem.vectorId, point.vectorId);
|
|
} else if (moveRoad.splitRoadId != null) {
|
|
} else if (moveRoad.splitRoadId != null) {
|
|
- wallService.splitWall(
|
|
|
|
|
|
+ roadService.splitRoad(
|
|
moveRoad.splitRoadId,
|
|
moveRoad.splitRoadId,
|
|
draggingItem.vectorId,
|
|
draggingItem.vectorId,
|
|
"start"
|
|
"start"
|
|
@@ -417,12 +424,12 @@ export default class Layer {
|
|
case LayerEvents.AddingRoad:
|
|
case LayerEvents.AddingRoad:
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
if (addRoad.startInfo && addRoad.startInfo.linkedPointId) {
|
|
if (addRoad.startInfo && addRoad.startInfo.linkedPointId) {
|
|
- let addWallStartPoint = dataService.getPoint(
|
|
|
|
|
|
+ let addRoadStartPoint = dataService.getPoint(
|
|
addRoad.startInfo.linkedPointId
|
|
addRoad.startInfo.linkedPointId
|
|
);
|
|
);
|
|
if (
|
|
if (
|
|
addRoad.endInfo.position &&
|
|
addRoad.endInfo.position &&
|
|
- Object.keys(addWallStartPoint.parent).length > 1
|
|
|
|
|
|
+ Object.keys(addRoadStartPoint.parent).length > 1
|
|
) {
|
|
) {
|
|
stateService.clearEventName();
|
|
stateService.clearEventName();
|
|
addRoad.clear();
|
|
addRoad.clear();
|
|
@@ -432,27 +439,19 @@ export default class Layer {
|
|
break;
|
|
break;
|
|
case LayerEvents.MoveRoad:
|
|
case LayerEvents.MoveRoad:
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
- if (focusItem != null && focusItem.type == VectorType.Wall) {
|
|
|
|
- const wall = dataService.getWall(focusItem.vectorId);
|
|
|
|
- if (wall.import || wall.out) {
|
|
|
|
- this.uiControl.currentUI = "OutWall";
|
|
|
|
- } else {
|
|
|
|
- this.uiControl.currentUI = focusItem.type;
|
|
|
|
- }
|
|
|
|
- this.history.save();
|
|
|
|
- } else {
|
|
|
|
- this.history.save();
|
|
|
|
|
|
+ if (focusItem != null && focusItem.type == VectorType.Road) {
|
|
|
|
+ const road = dataService.getRoad(focusItem.vectorId);
|
|
|
|
+ this.uiControl.currentUI = focusItem.type;
|
|
}
|
|
}
|
|
|
|
+ this.history.save();
|
|
moveRoad.setStartMoving(false);
|
|
moveRoad.setStartMoving(false);
|
|
break;
|
|
break;
|
|
case LayerEvents.MoveTag:
|
|
case LayerEvents.MoveTag:
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
if (focusItem != null && focusItem.type == VectorType.Tag) {
|
|
if (focusItem != null && focusItem.type == VectorType.Tag) {
|
|
this.uiControl.currentUI = focusItem.type;
|
|
this.uiControl.currentUI = focusItem.type;
|
|
- this.history.save();
|
|
|
|
- } else {
|
|
|
|
- this.history.save();
|
|
|
|
}
|
|
}
|
|
|
|
+ this.history.save();
|
|
break;
|
|
break;
|
|
case LayerEvents.AddTag:
|
|
case LayerEvents.AddTag:
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
@@ -465,7 +464,6 @@ export default class Layer {
|
|
};
|
|
};
|
|
stateService.setFocusItem(focusItem);
|
|
stateService.setFocusItem(focusItem);
|
|
this.history.save();
|
|
this.history.save();
|
|
- //}
|
|
|
|
this.uiControl.currentUI = focusItem.type;
|
|
this.uiControl.currentUI = focusItem.type;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -476,9 +474,6 @@ export default class Layer {
|
|
}
|
|
}
|
|
|
|
|
|
onWheel(e) {
|
|
onWheel(e) {
|
|
- if (coordinate.defaultCenter == null) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
e.preventDefault();
|
|
e.preventDefault();
|
|
const type = e.type;
|
|
const type = e.type;
|
|
if (type == "DOMMouseScroll" || type == "mousewheel") {
|
|
if (type == "DOMMouseScroll" || type == "mousewheel") {
|
|
@@ -496,68 +491,6 @@ export default class Layer {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- // onKeydown(e) {
|
|
|
|
- // if (!this.display) {
|
|
|
|
- // return;
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
- // if (e.ctrlKey && e.code == "KeyZ") {
|
|
|
|
- // this.stopAddVector();
|
|
|
|
- // // 撤销
|
|
|
|
- // if (!this.$xui.toolbar.recall) {
|
|
|
|
- // this.renderer.autoRedraw();
|
|
|
|
- // return;
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
- // let floor = this.app.store.getValue("flooruser");
|
|
|
|
- // if (floor.type == "image") {
|
|
|
|
- // this.renderer.autoRedraw();
|
|
|
|
- // return;
|
|
|
|
- // }
|
|
|
|
- // this.revokeHistory();
|
|
|
|
- // console.log("ctrl+z");
|
|
|
|
- // } else if (e.ctrlKey && e.code == "KeyY") {
|
|
|
|
- // // 恢复
|
|
|
|
- // if (!this.$xui.toolbar.recover) {
|
|
|
|
- // return;
|
|
|
|
- // }
|
|
|
|
- // this.recoveryHistory();
|
|
|
|
- // console.log("ctrl+y");
|
|
|
|
- // } else if (e.code == "Delete") {
|
|
|
|
- // this.deleteItem();
|
|
|
|
- // this.uiControl.currentUI = null;
|
|
|
|
- // //this.$xui.hideProps()
|
|
|
|
- // this.history.save();
|
|
|
|
- // this.renderer.autoRedraw();
|
|
|
|
- // console.log("Delete");
|
|
|
|
- // } else if (e.code == "Escape") {
|
|
|
|
- // this.stopAddVector();
|
|
|
|
- // this.renderer.autoRedraw();
|
|
|
|
- // console.log("Esc");
|
|
|
|
- // } else {
|
|
|
|
- // let focusItem = stateService.getFocusItem();
|
|
|
|
- // let draggingItem = stateService.getDraggingItem();
|
|
|
|
- // if (focusItem && !draggingItem) {
|
|
|
|
- // if (e.ctrlKey && e.code == "KeyC") {
|
|
|
|
- // //复制
|
|
|
|
- // keyService.copy(focusItem, this.mousePosition);
|
|
|
|
- // this.renderer.autoRedraw();
|
|
|
|
- // this.history.save();
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
- // // if (e.ctrlKey && e.code == 'KeyV') {
|
|
|
|
- // // //粘贴
|
|
|
|
- // // const flag = keyService.paste()
|
|
|
|
- // // if (flag) {
|
|
|
|
- // // keyService.clearTargetItem()
|
|
|
|
- // // this.renderer.autoRedraw()
|
|
|
|
- // // this.history.save()
|
|
|
|
- // // }
|
|
|
|
- // // }
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
setEventName(eventType) {
|
|
setEventName(eventType) {
|
|
let eventName = stateService.getEventName();
|
|
let eventName = stateService.getEventName();
|
|
|
|
|
|
@@ -566,34 +499,12 @@ export default class Layer {
|
|
const selectItem = stateService.getSelectItem();
|
|
const selectItem = stateService.getSelectItem();
|
|
if (selectItem == null) {
|
|
if (selectItem == null) {
|
|
stateService.setEventName(LayerEvents.PanBackGround);
|
|
stateService.setEventName(LayerEvents.PanBackGround);
|
|
- } else if (selectItem.type == VectorType.Wall) {
|
|
|
|
|
|
+ } else if (selectItem.type == VectorType.Road) {
|
|
stateService.setEventName(LayerEvents.MoveRoad);
|
|
stateService.setEventName(LayerEvents.MoveRoad);
|
|
- } else if (selectItem.type == VectorType.WallCorner) {
|
|
|
|
- stateService.setEventName(LayerEvents.MoveWallPoint);
|
|
|
|
- } else if (symbolService.isSymbol(selectItem.type)) {
|
|
|
|
- if (
|
|
|
|
- selectItem.selectIndex == SelectState.All ||
|
|
|
|
- selectItem.selectIndex == SelectState.Select
|
|
|
|
- ) {
|
|
|
|
- stateService.setEventName(LayerEvents.MoveSymbol);
|
|
|
|
- //需要保留当前的长度
|
|
|
|
- const symbol = dataService.getSymbol(selectItem.vectorId);
|
|
|
|
- symbol.len = mathUtil.getDistance(
|
|
|
|
- symbol.startPoint,
|
|
|
|
- symbol.endPoint
|
|
|
|
- );
|
|
|
|
- } else if (
|
|
|
|
- selectItem.selectIndex == SelectState.Start ||
|
|
|
|
- selectItem.selectIndex == SelectState.End
|
|
|
|
- ) {
|
|
|
|
- stateService.setEventName(LayerEvents.MoveSymbolPoint);
|
|
|
|
- }
|
|
|
|
- } else if (componentService.isComponent(selectItem.type)) {
|
|
|
|
- stateService.setEventName(LayerEvents.MoveComponent);
|
|
|
|
|
|
+ } else if (selectItem.type == VectorType.RoadCorner) {
|
|
|
|
+ stateService.setEventName(LayerEvents.MoveRoadPoint);
|
|
} else if (selectItem.type == VectorType.Tag) {
|
|
} else if (selectItem.type == VectorType.Tag) {
|
|
stateService.setEventName(LayerEvents.MoveTag);
|
|
stateService.setEventName(LayerEvents.MoveTag);
|
|
- } else if (furnitureService.isFurniture(selectItem.type)) {
|
|
|
|
- stateService.setEventName(LayerEvents.MoveFurniture);
|
|
|
|
}
|
|
}
|
|
} else if (eventName == LayerEvents.AddRoad) {
|
|
} else if (eventName == LayerEvents.AddRoad) {
|
|
stateService.setEventName(LayerEvents.AddingRoad);
|
|
stateService.setEventName(LayerEvents.AddingRoad);
|
|
@@ -655,7 +566,7 @@ export default class Layer {
|
|
} else if (item.type == VectorType.Tag) {
|
|
} else if (item.type == VectorType.Tag) {
|
|
dataService.deleteTag(item.vectorId);
|
|
dataService.deleteTag(item.vectorId);
|
|
} else if (item.type == VectorType.RoadCorner) {
|
|
} else if (item.type == VectorType.RoadCorner) {
|
|
- //这个比较复杂,参考deleteWallCorner
|
|
|
|
|
|
+ //这个比较复杂,参考deleteRoadCorner
|
|
//dataService.deletePoint(item.vectorId);
|
|
//dataService.deletePoint(item.vectorId);
|
|
}
|
|
}
|
|
this.history.save();
|
|
this.history.save();
|