|
@@ -3,10 +3,12 @@ import { stateService } from './Service/StateService'
|
|
|
import { elementService } from './Service/ElementService'
|
|
|
import { floorplanService } from './Service/FloorplanService'
|
|
|
import { tagService } from './Service/TagService'
|
|
|
+import { tableService } from './Service/TableService'
|
|
|
import { historyService } from './Service/HistoryService'
|
|
|
|
|
|
import UIControl from './Controls/UIControl'
|
|
|
import { moveTag } from './Controls/MoveTag'
|
|
|
+import { moveTable } from './Controls/MoveTable'
|
|
|
import { addWall } from './Controls/AddWall'
|
|
|
import { moveWall } from './Controls/MoveWall'
|
|
|
import { addRectangle } from './Controls/AddRectangle'
|
|
@@ -151,6 +153,12 @@ export default class Layer {
|
|
|
onMouseMove(e) {
|
|
|
const X = e.offsetX || e.layerX
|
|
|
const Y = e.offsetY || e.layerY
|
|
|
+ if(this.lastX == null){
|
|
|
+ this.lastX = X;
|
|
|
+ }
|
|
|
+ if(this.lastY == null){
|
|
|
+ this.lastY = Y;
|
|
|
+ }
|
|
|
let dx = X - this.lastX
|
|
|
let dy = Y - this.lastY
|
|
|
|
|
@@ -420,13 +428,39 @@ export default class Layer {
|
|
|
stateService.setDraggingItem(stateService.selectItem)
|
|
|
}
|
|
|
} else {
|
|
|
- moveTag.moveFullTag(position, draggingItem.vectorId)
|
|
|
+ moveTag.moveFullTag(dx,dy, draggingItem.vectorId)
|
|
|
+ this.lastX = X
|
|
|
+ this.lastY = Y
|
|
|
}
|
|
|
break
|
|
|
case LayerEvents.MoveTag:
|
|
|
needAutoRedraw = true
|
|
|
if (draggingItem != null) {
|
|
|
- moveTag.moveFullTag(position, draggingItem.vectorId)
|
|
|
+ moveTag.moveFullTag(dx,dy, draggingItem.vectorId)
|
|
|
+ this.lastX = X
|
|
|
+ this.lastY = Y
|
|
|
+ }
|
|
|
+ break
|
|
|
+ case LayerEvents.AddTable:
|
|
|
+ needAutoRedraw = true
|
|
|
+ if (draggingItem == null) {
|
|
|
+ const table = tableService.createTable(position)
|
|
|
+ if (table.vectorId) {
|
|
|
+ stateService.setSelectItem(table.vectorId, VectorType.Table, SelectState.All)
|
|
|
+ stateService.setDraggingItem(stateService.selectItem)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ moveTable.moveFullTable(dx,dy, draggingItem.vectorId)
|
|
|
+ this.lastX = X
|
|
|
+ this.lastY = Y
|
|
|
+ }
|
|
|
+ break
|
|
|
+ case LayerEvents.MoveTable:
|
|
|
+ needAutoRedraw = true
|
|
|
+ if (draggingItem != null) {
|
|
|
+ moveTable.moveFullTable(dx,dy, draggingItem.vectorId)
|
|
|
+ this.lastX = X
|
|
|
+ this.lastY = Y
|
|
|
}
|
|
|
break
|
|
|
case LayerEvents.AddSign:
|
|
@@ -659,6 +693,21 @@ export default class Layer {
|
|
|
break
|
|
|
case LayerEvents.AddTag:
|
|
|
needAutoRedraw = true
|
|
|
+ this.uiControl.showAttributes(focusItem)
|
|
|
+ this.history.save()
|
|
|
+ break
|
|
|
+ case LayerEvents.MoveTable:
|
|
|
+ if(focusItem == null){
|
|
|
+ needAutoRedraw = true
|
|
|
+ this.history.save()
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.uiControl.showAttributes(focusItem);
|
|
|
+ }
|
|
|
+ break
|
|
|
+ case LayerEvents.AddTable:
|
|
|
+ needAutoRedraw = true
|
|
|
+ this.uiControl.showAttributes(focusItem)
|
|
|
this.history.save()
|
|
|
break
|
|
|
case LayerEvents.AddSign:
|
|
@@ -676,7 +725,8 @@ export default class Layer {
|
|
|
}
|
|
|
break
|
|
|
}
|
|
|
-
|
|
|
+ this.lastX = null;
|
|
|
+ this.lastY = null;
|
|
|
this.setEventName('mouseUp')
|
|
|
stateService.clearDraggingItem()
|
|
|
this.renderer.autoRedraw()
|
|
@@ -768,7 +818,9 @@ export default class Layer {
|
|
|
else{
|
|
|
stateService.setEventName(LayerEvents.moveArrowVertex)
|
|
|
}
|
|
|
- }
|
|
|
+ } else if (selectItem.type == VectorType.Table) {
|
|
|
+ stateService.setEventName(LayerEvents.MoveTable)
|
|
|
+ }
|
|
|
}
|
|
|
else if (eventName == LayerEvents.AddWall) {
|
|
|
stateService.setEventName(LayerEvents.AddingWall)
|
|
@@ -795,10 +847,10 @@ export default class Layer {
|
|
|
{
|
|
|
stateService.setEventName(LayerEvents.AddingArrow)
|
|
|
}
|
|
|
- // else if (eventName == LayerEvents.AddingRectangle)
|
|
|
- // {
|
|
|
- // stateService.clearEventName()
|
|
|
- // }
|
|
|
+ else if (eventName == LayerEvents.AddTable)
|
|
|
+ {
|
|
|
+ stateService.clearEventName()
|
|
|
+ }
|
|
|
else if (eventName != LayerEvents.AddWall && eventName != LayerEvents.AddingWall ) { //&& eventName != LayerEvents.AddRectangle && eventName != LayerEvents.AddingRectangle && eventName != LayerEvents.AddCircle && eventName != LayerEvents.AddingCircle && eventName != LayerEvents.AddArrow && eventName != LayerEvents.AddingArrow && eventName != LayerEvents.AddIcon && eventName != LayerEvents.AddingIcon
|
|
|
stateService.clearEventName()
|
|
|
}
|
|
@@ -821,7 +873,14 @@ export default class Layer {
|
|
|
tagService.deleteTag(draggingItem.vectorId)
|
|
|
this.uiControl.clearUI();
|
|
|
}
|
|
|
- } else if (eventName == LayerEvents.AddSign) {
|
|
|
+ }
|
|
|
+ else if (eventName == LayerEvents.AddTable) {
|
|
|
+ if (draggingItem && draggingItem.vectorId) {
|
|
|
+ tableService.deleteTable(draggingItem.vectorId)
|
|
|
+ this.uiControl.clearUI();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (eventName == LayerEvents.AddSign) {
|
|
|
if (draggingItem && draggingItem.vectorId) {
|
|
|
floorplanService.deleteSign(draggingItem.vectorId)
|
|
|
}
|
|
@@ -843,6 +902,8 @@ export default class Layer {
|
|
|
floorplanService.deleteComponent(item.vectorId)
|
|
|
} else if (item.type == VectorType.Tag) {
|
|
|
floorplanService.deleteTag(item.vectorId)
|
|
|
+ } else if (item.type == VectorType.Table) {
|
|
|
+ floorplanService.deleteTable(item.vectorId)
|
|
|
} else if (signService.isSign(item.type)) {
|
|
|
floorplanService.deleteSign(item.vectorId)
|
|
|
} else if (item.type == VectorType.WallCorner) {
|