|
|
@@ -77,7 +77,7 @@ export default class Layer {
|
|
|
// 右键
|
|
|
if (e.button == 2) {
|
|
|
this.stopAddVector()
|
|
|
- this.uiControl.currentUI = null
|
|
|
+ this.uiControl.selectUI = null
|
|
|
this.renderer.autoRedraw()
|
|
|
return
|
|
|
}
|
|
|
@@ -139,9 +139,9 @@ export default class Layer {
|
|
|
stateService.setDraggingItem(selectItem)
|
|
|
//stateService.setFocusItem(selectItem)
|
|
|
//this.uiControl.showAttributes()
|
|
|
- this.uiControl.currentUI = selectItem.type
|
|
|
+ this.uiControl.selectUI = selectItem.type
|
|
|
} else if (eventName == null) {
|
|
|
- this.uiControl.currentUI = null
|
|
|
+ this.uiControl.selectUI = null
|
|
|
}
|
|
|
}
|
|
|
this.setEventName('mouseDown')
|
|
|
@@ -169,7 +169,7 @@ export default class Layer {
|
|
|
const draggingItem = stateService.getDraggingItem()
|
|
|
switch (eventName) {
|
|
|
case null:
|
|
|
- //监控
|
|
|
+ //监控当前选择的构件
|
|
|
needAutoRedraw = listenLayer.start(position)
|
|
|
break
|
|
|
case LayerEvents.PanBackGround:
|
|
|
@@ -479,9 +479,12 @@ export default class Layer {
|
|
|
type: draggingItem.type,
|
|
|
cursor: { x: this.lastX, y: this.lastY },
|
|
|
}
|
|
|
- stateService.setFocusItem(focusItem)
|
|
|
- this.uiControl.showAttributes()
|
|
|
+ this.uiControl.showAttributes(focusItem)
|
|
|
}
|
|
|
+ else{
|
|
|
+ focusItem = null;
|
|
|
+ }
|
|
|
+ stateService.setFocusItem(focusItem)
|
|
|
}
|
|
|
|
|
|
let position = coordinate.getXYFromScreen({
|
|
|
@@ -495,30 +498,35 @@ export default class Layer {
|
|
|
case LayerEvents.PanBackGround:
|
|
|
needAutoRedraw = true
|
|
|
stateService.clearFocusItem()
|
|
|
- this.uiControl.currentUI = null
|
|
|
+ this.uiControl.selectUI = null
|
|
|
break
|
|
|
case LayerEvents.MoveWallPoint:
|
|
|
- needAutoRedraw = true
|
|
|
- elementService.hideAll()
|
|
|
- let point = floorplanService.getPoint(draggingItem.vectorId)
|
|
|
- if (point) {
|
|
|
- //if (focusItem == null) {
|
|
|
- listenLayer.start(point, draggingItem.vectorId, point.parent)
|
|
|
-
|
|
|
- if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty('linkedPointId')) {
|
|
|
- wallService.moveTo(draggingItem.vectorId, listenLayer.modifyPoint.linkedPointId)
|
|
|
- } else if (listenLayer.modifyPoint && (listenLayer.modifyPoint.linkedPointIdX || listenLayer.modifyPoint.linkedPointIdY)) {
|
|
|
- mathUtil.clonePoint(point, listenLayer.modifyPoint)
|
|
|
- } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty('linkedWallId')) {
|
|
|
- point = wallService.createPoint(listenLayer.modifyPoint.x, listenLayer.modifyPoint.y)
|
|
|
- wallService.splitWall(listenLayer.modifyPoint.linkedWallId, point.vectorId, 'start')
|
|
|
- wallService.moveTo(draggingItem.vectorId, point.vectorId)
|
|
|
- } else if (moveWall.splitWallId != null) {
|
|
|
- wallService.splitWall(moveWall.splitWallId, draggingItem.vectorId, 'start')
|
|
|
+ if(focusItem == null){
|
|
|
+ needAutoRedraw = true
|
|
|
+ elementService.hideAll()
|
|
|
+ let point = floorplanService.getPoint(draggingItem.vectorId)
|
|
|
+ if (point) {
|
|
|
+
|
|
|
+ listenLayer.start(point, draggingItem.vectorId, point.parent)
|
|
|
+
|
|
|
+ if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty('linkedPointId')) {
|
|
|
+ wallService.moveTo(draggingItem.vectorId, listenLayer.modifyPoint.linkedPointId)
|
|
|
+ } else if (listenLayer.modifyPoint && (listenLayer.modifyPoint.linkedPointIdX || listenLayer.modifyPoint.linkedPointIdY)) {
|
|
|
+ mathUtil.clonePoint(point, listenLayer.modifyPoint)
|
|
|
+ } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty('linkedWallId')) {
|
|
|
+ point = wallService.createPoint(listenLayer.modifyPoint.x, listenLayer.modifyPoint.y)
|
|
|
+ wallService.splitWall(listenLayer.modifyPoint.linkedWallId, point.vectorId, 'start')
|
|
|
+ wallService.moveTo(draggingItem.vectorId, point.vectorId)
|
|
|
+ } else if (moveWall.splitWallId != null) {
|
|
|
+ wallService.splitWall(moveWall.splitWallId, draggingItem.vectorId, 'start')
|
|
|
+ }
|
|
|
+ //draggingItem.vectorId所在的墙面与其他墙角相交
|
|
|
+ moveWall.updateForAbsorbWallPoints()
|
|
|
+ this.history.save()
|
|
|
}
|
|
|
- //draggingItem.vectorId所在的墙面与其他墙角相交
|
|
|
- moveWall.updateForAbsorbWallPoints()
|
|
|
- this.history.save()
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.uiControl.showAttributes(focusItem);
|
|
|
}
|
|
|
break
|
|
|
case LayerEvents.AddingWall:
|
|
|
@@ -529,56 +537,48 @@ export default class Layer {
|
|
|
stateService.clearEventName()
|
|
|
addWall.clear()
|
|
|
elementService.hideAll()
|
|
|
+ this.uiControl.selectUI = null
|
|
|
+ this.history.save()
|
|
|
}
|
|
|
}
|
|
|
break
|
|
|
case LayerEvents.MoveWall:
|
|
|
- needAutoRedraw = true
|
|
|
- if (focusItem != null && focusItem.type == VectorType.Wall) {
|
|
|
- const wall = floorplanService.getWall(focusItem.vectorId)
|
|
|
- this.uiControl.currentUI = focusItem.type
|
|
|
- this.history.save()
|
|
|
- } else {
|
|
|
+ if(focusItem == null){
|
|
|
+ needAutoRedraw = true
|
|
|
this.history.save()
|
|
|
}
|
|
|
+ else{
|
|
|
+ this.uiControl.showAttributes(focusItem);
|
|
|
+ }
|
|
|
break
|
|
|
case LayerEvents.AddingRectangle:
|
|
|
- //const rectangle = floorplanService.getRectangle(addRectangle.currentVectorId)
|
|
|
+ needAutoRedraw = true
|
|
|
if(mathUtil.getDistance(addRectangle.start,addRectangle.end)<Constant.minAdsorb){
|
|
|
floorplanService.deleteRectangle(addRectangle.currentVectorId)
|
|
|
}
|
|
|
stateService.clearEventName()
|
|
|
elementService.hideAll()
|
|
|
addRectangle.clear();
|
|
|
- //this.history.save()
|
|
|
+ this.history.save()
|
|
|
+ this.uiControl.selectUI = null
|
|
|
break
|
|
|
case LayerEvents.MoveRectangle:
|
|
|
- needAutoRedraw = true
|
|
|
- // if (focusItem != null && focusItem.type == VectorType.Tag) {
|
|
|
- // this.uiControl.currentUI = focusItem.type
|
|
|
- // this.history.save()
|
|
|
- // } else {
|
|
|
- // this.history.save()
|
|
|
- // }
|
|
|
+ if(focusItem == null){
|
|
|
+ needAutoRedraw = true
|
|
|
+ this.history.save()
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.uiControl.showAttributes(focusItem);
|
|
|
+ }
|
|
|
break
|
|
|
case LayerEvents.MoveRectangleVertex:
|
|
|
needAutoRedraw = true
|
|
|
elementService.hideAll()
|
|
|
- // if (focusItem != null && focusItem.type == VectorType.Tag) {
|
|
|
- // this.uiControl.currentUI = focusItem.type
|
|
|
- // this.history.save()
|
|
|
- // } else {
|
|
|
- // this.history.save()
|
|
|
- // }
|
|
|
+ this.history.save()
|
|
|
break
|
|
|
case LayerEvents.MoveRectangleSide:
|
|
|
needAutoRedraw = true
|
|
|
- // if (focusItem != null && focusItem.type == VectorType.Tag) {
|
|
|
- // this.uiControl.currentUI = focusItem.type
|
|
|
- // this.history.save()
|
|
|
- // } else {
|
|
|
- // this.history.save()
|
|
|
- // }
|
|
|
+ this.history.save()
|
|
|
break
|
|
|
case LayerEvents.AddingCircle:
|
|
|
if(addCircle.end != null && addCircle.currentVectorId != null)
|
|
|
@@ -586,83 +586,92 @@ export default class Layer {
|
|
|
if(mathUtil.getDistance(addCircle.start,addCircle.end)<Constant.minAdsorb){
|
|
|
floorplanService.deleteCircle(addCircle.currentVectorId)
|
|
|
}
|
|
|
+ needAutoRedraw = true
|
|
|
}
|
|
|
stateService.clearEventName()
|
|
|
elementService.hideAll()
|
|
|
addCircle.clear();
|
|
|
+ this.history.save()
|
|
|
+ this.uiControl.selectUI = null
|
|
|
break
|
|
|
case LayerEvents.MoveCircle:
|
|
|
- needAutoRedraw = true
|
|
|
+ if(focusItem == null){
|
|
|
+ needAutoRedraw = true
|
|
|
+ this.history.save()
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.uiControl.showAttributes(focusItem);
|
|
|
+ }
|
|
|
break
|
|
|
case LayerEvents.MoveCircleVertex:
|
|
|
needAutoRedraw = true
|
|
|
+ this.history.save()
|
|
|
break
|
|
|
case LayerEvents.AddingIcon:
|
|
|
if(addIcon.end != null && addIcon.currentVectorId != null){
|
|
|
if(mathUtil.getDistance(addIcon.start,addIcon.end)<Constant.minAdsorb){
|
|
|
floorplanService.deleteIcon(addIcon.currentVectorId)
|
|
|
}
|
|
|
+ needAutoRedraw = true
|
|
|
}
|
|
|
stateService.clearEventName()
|
|
|
elementService.hideAll()
|
|
|
addIcon.clear();
|
|
|
+ this.history.save()
|
|
|
+ this.uiControl.selectUI = null
|
|
|
break
|
|
|
case LayerEvents.MoveIcon:
|
|
|
- needAutoRedraw = true
|
|
|
+ if(focusItem == null){
|
|
|
+ needAutoRedraw = true
|
|
|
+ this.history.save()
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.uiControl.showAttributes(focusItem);
|
|
|
+ }
|
|
|
break
|
|
|
case LayerEvents.MoveIconVertex:
|
|
|
needAutoRedraw = true
|
|
|
+ this.history.save()
|
|
|
break
|
|
|
case LayerEvents.AddingArrow:
|
|
|
if(addArrow.start != null && addArrow.currentVectorId != null){
|
|
|
if(mathUtil.getDistance(addArrow.start,addArrow.end)<Constant.minAdsorb){
|
|
|
floorplanService.deleteArrow(addArrow.currentVectorId)
|
|
|
}
|
|
|
+ needAutoRedraw = true
|
|
|
}
|
|
|
stateService.clearEventName()
|
|
|
elementService.hideAll()
|
|
|
addArrow.clear();
|
|
|
+ this.history.save()
|
|
|
+ this.uiControl.selectUI = null
|
|
|
break
|
|
|
case LayerEvents.MoveArrow:
|
|
|
needAutoRedraw = true
|
|
|
+ this.history.save()
|
|
|
break
|
|
|
case LayerEvents.MoveTag:
|
|
|
- needAutoRedraw = true
|
|
|
- if (focusItem != null && focusItem.type == VectorType.Tag) {
|
|
|
- this.uiControl.currentUI = focusItem.type
|
|
|
- this.history.save()
|
|
|
- } else {
|
|
|
+ if(focusItem == null){
|
|
|
+ needAutoRedraw = true
|
|
|
this.history.save()
|
|
|
}
|
|
|
+ else{
|
|
|
+ this.uiControl.showAttributes(focusItem);
|
|
|
+ }
|
|
|
break
|
|
|
case LayerEvents.AddTag:
|
|
|
needAutoRedraw = true
|
|
|
- let tag = floorplanService.getTag(draggingItem.vectorId)
|
|
|
- tag.setAdding(false)
|
|
|
- focusItem = {
|
|
|
- vectorId: draggingItem.vectorId,
|
|
|
- type: draggingItem.type,
|
|
|
- cursor: { x: this.lastX, y: this.lastY },
|
|
|
- }
|
|
|
- stateService.setFocusItem(focusItem)
|
|
|
this.history.save()
|
|
|
- this.uiControl.currentUI = focusItem.type
|
|
|
break
|
|
|
case LayerEvents.AddSign:
|
|
|
- focusItem = {
|
|
|
- vectorId: draggingItem.vectorId,
|
|
|
- type: draggingItem.type,
|
|
|
- cursor: { x: this.lastX, y: this.lastY },
|
|
|
- }
|
|
|
- stateService.setFocusItem(focusItem)
|
|
|
- this.uiControl.showAttributes()
|
|
|
- this.uiControl.currentUI = focusItem.type
|
|
|
+ needAutoRedraw = true
|
|
|
+ this.uiControl.selectUI = null
|
|
|
this.history.save()
|
|
|
break
|
|
|
case LayerEvents.MoveSign:
|
|
|
needAutoRedraw = true
|
|
|
if (focusItem != null && signService.isSign(focusItem.type)) {
|
|
|
- this.uiControl.currentUI = focusItem.type
|
|
|
+ this.uiControl.selectUI = focusItem.type
|
|
|
this.history.save()
|
|
|
} else {
|
|
|
debugger
|
|
|
@@ -704,7 +713,7 @@ export default class Layer {
|
|
|
console.log('ctrl+y')
|
|
|
} else if (e.code == 'Delete') {
|
|
|
this.deleteItem()
|
|
|
- this.uiControl.currentUI = null
|
|
|
+ this.uiControl.selectUI = null
|
|
|
this.history.save()
|
|
|
this.renderer.autoRedraw()
|
|
|
console.log('Delete')
|
|
|
@@ -771,7 +780,7 @@ export default class Layer {
|
|
|
} else if (eventType == 'mouseUp') {
|
|
|
if (eventName == LayerEvents.AddTag)
|
|
|
{
|
|
|
- //可连续添加
|
|
|
+ stateService.clearEventName()
|
|
|
}
|
|
|
else if (eventName == LayerEvents.AddRectangle)
|
|
|
{
|
|
|
@@ -813,7 +822,7 @@ export default class Layer {
|
|
|
if (eventName == LayerEvents.AddTag) {
|
|
|
if (draggingItem && draggingItem.vectorId) {
|
|
|
tagService.deleteTag(draggingItem.vectorId)
|
|
|
- this.uiControl.currentUI = null
|
|
|
+ this.uiControl.selectUI = null
|
|
|
}
|
|
|
} else if (eventName == LayerEvents.AddSign) {
|
|
|
if (draggingItem && draggingItem.vectorId) {
|