|
@@ -18,13 +18,33 @@ export default class ListenLayer {
|
|
|
state: null,
|
|
|
}
|
|
|
|
|
|
- this.componentInfo = {
|
|
|
- componentId: null,
|
|
|
+ this.tagInfo = {
|
|
|
+ tagId: null,
|
|
|
state: null,
|
|
|
}
|
|
|
|
|
|
- this.tagInfo = {
|
|
|
- tagId: null,
|
|
|
+ this.tableInfo = {
|
|
|
+ tableId: null,
|
|
|
+ state: null,
|
|
|
+ }
|
|
|
+
|
|
|
+ this.rectangleInfo = {
|
|
|
+ rectangleId: null,
|
|
|
+ state: null,
|
|
|
+ }
|
|
|
+
|
|
|
+ this.circleInfo = {
|
|
|
+ circleId: null,
|
|
|
+ state: null,
|
|
|
+ }
|
|
|
+
|
|
|
+ this.arrowInfo = {
|
|
|
+ arrowId: null,
|
|
|
+ state: null,
|
|
|
+ }
|
|
|
+
|
|
|
+ this.iconInfo = {
|
|
|
+ iconId: null,
|
|
|
state: null,
|
|
|
}
|
|
|
|
|
@@ -39,20 +59,6 @@ export default class ListenLayer {
|
|
|
//开始监听,exceptPointId表示不考虑的点,exceptWallIds表示不考虑的墙
|
|
|
start(position, exceptPointId, exceptWallIds) {
|
|
|
let nearest = this.getNearForVectors(position, exceptPointId, exceptWallIds)
|
|
|
- /*
|
|
|
- // getNearForWalls在一定的条件下必须执行两次!
|
|
|
- // 如果吸附在墙面上,或者吸附在其余墙的顶点(x/y坐标),这时候因为抖动,可能会变成完全吸附在墙角,这时候是要再执行一次getNearForWalls
|
|
|
- if (
|
|
|
- nearest.modifyPoint &&
|
|
|
- (nearest.modifyPoint.hasOwnProperty("linkedPointIdX") ||
|
|
|
- nearest.modifyPoint.hasOwnProperty("linkedPointIdY") ||
|
|
|
- nearest.modifyPoint.hasOwnProperty("linkedWallId"))
|
|
|
- ) {
|
|
|
- mathUtil.clonePoint(position, nearest.modifyPoint);
|
|
|
- nearest = this.getNearForVectors(position, exceptPointId, exceptWallIds);
|
|
|
- }
|
|
|
- */
|
|
|
-
|
|
|
if (
|
|
|
nearest.modifyPoint &&
|
|
|
(nearest.modifyPoint.hasOwnProperty('linkedPointId') ||
|
|
@@ -234,10 +240,15 @@ export default class ListenLayer {
|
|
|
_modifyPoint.linkedWallId = wallId
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
const result = {
|
|
|
minPoint: min1,
|
|
|
minWall: min2,
|
|
|
- componentInfo: {},
|
|
|
+ tableInfo: {},
|
|
|
+ rectangleInfo: {},
|
|
|
+ circleInfo: {},
|
|
|
+ arrowInfo: {},
|
|
|
+ iconInfo: {},
|
|
|
tagInfo: {},
|
|
|
signInfo: {},
|
|
|
}
|
|
@@ -256,26 +267,78 @@ export default class ListenLayer {
|
|
|
result.modifyPoint.y = modifyPoint.y
|
|
|
}
|
|
|
|
|
|
- const components = floorplanService.getComponents()
|
|
|
- for (const componentId in components) {
|
|
|
- const component = floorplanService.getComponent(componentId)
|
|
|
- const location = component.isContain(position)
|
|
|
+ const tags = floorplanService.getTags()
|
|
|
+ for (const tagId in tags) {
|
|
|
+ const tag = floorplanService.getTag(tagId)
|
|
|
+ const location = tag.isContain(position)
|
|
|
+ if (location) {
|
|
|
+ result.tagInfo = {
|
|
|
+ tagId: tagId,
|
|
|
+ state: 'all',
|
|
|
+ }
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // const tables = floorplanService.getTables()
|
|
|
+ // for (const tableId in tables) {
|
|
|
+ // const table = floorplanService.getTable(tableId)
|
|
|
+ // const location = table.isContain(position)
|
|
|
+ // if (location) {
|
|
|
+ // result.tableInfo = {
|
|
|
+ // tableId: tableId,
|
|
|
+ // state: 'all',
|
|
|
+ // }
|
|
|
+ // break
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ const rectangles = floorplanService.getRectangles()
|
|
|
+ for (const rectangleId in rectangles) {
|
|
|
+ const rectangle = floorplanService.getRectangle(rectangleId)
|
|
|
+ const location = rectangle.isContain(position)
|
|
|
if (location) {
|
|
|
- result.componentInfo = {
|
|
|
- componentId: componentId,
|
|
|
+ result.rectangleInfo = {
|
|
|
+ rectangleId: rectangleId,
|
|
|
state: 'all',
|
|
|
}
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- const tags = floorplanService.getTags()
|
|
|
- for (const tagId in tags) {
|
|
|
- const tag = floorplanService.getTag(tagId)
|
|
|
- const location = tag.isContain(position)
|
|
|
+ const circles = floorplanService.getCircles()
|
|
|
+ for (const circleId in circles) {
|
|
|
+ const circle = floorplanService.getRectangle(circleId)
|
|
|
+ const location = circle.isContain(position)
|
|
|
if (location) {
|
|
|
- result.tagInfo = {
|
|
|
- tagId: tagId,
|
|
|
+ result.circleInfo = {
|
|
|
+ circleId: circleId,
|
|
|
+ state: 'all',
|
|
|
+ }
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const arrows = floorplanService.getArrows()
|
|
|
+ for (const arrowId in arrows) {
|
|
|
+ const arrow = floorplanService.getRectangle(arrowId)
|
|
|
+ const location = arrow.isContain(position)
|
|
|
+ if (location) {
|
|
|
+ result.arrowInfo = {
|
|
|
+ arrowId: arrowId,
|
|
|
+ state: 'all',
|
|
|
+ }
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const icons = floorplanService.getIcons()
|
|
|
+ for (const iconId in icons) {
|
|
|
+ const icon = floorplanService.getRectangle(iconId)
|
|
|
+ const location = icon.isContain(position)
|
|
|
+ if (location) {
|
|
|
+ result.iconInfo = {
|
|
|
+ iconId: iconId,
|
|
|
state: 'all',
|
|
|
}
|
|
|
break
|