|
@@ -1268,32 +1268,42 @@ export class EditScence extends SGraphScene {
|
|
let minAnchor = null;
|
|
let minAnchor = null;
|
|
let len: number = -1;
|
|
let len: number = -1;
|
|
this.Nodes.forEach(image => {
|
|
this.Nodes.forEach(image => {
|
|
- image.showAnchor = false;
|
|
|
|
|
|
+ // image.showAnchor = false;
|
|
if (image.anchorList && image.anchorList.length) {
|
|
if (image.anchorList && image.anchorList.length) {
|
|
- image.anchorList.forEach(anchor => {
|
|
|
|
- let anchorPoint = anchor.mapToScene(0, 0);
|
|
|
|
- let dis = SMathUtil.pointDistance(
|
|
|
|
- event.x,
|
|
|
|
- event.y,
|
|
|
|
- anchorPoint.x,
|
|
|
|
- anchorPoint.y
|
|
|
|
- );
|
|
|
|
- if (len < 0) {
|
|
|
|
- len = anchor.sceneDis;
|
|
|
|
- }
|
|
|
|
- if (dis < len) {
|
|
|
|
- minAnchor = anchor;
|
|
|
|
- len = dis;
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ let scenePoint = image.mapFromScene(event.x, event.y);
|
|
|
|
+ if (image.contains(scenePoint.x, scenePoint.y)) {
|
|
|
|
+ image.anchorList.forEach(anchor => {
|
|
|
|
+ let anchorPoint = anchor.mapToScene(0, 0);
|
|
|
|
+ let dis = SMathUtil.pointDistance(
|
|
|
|
+ event.x,
|
|
|
|
+ event.y,
|
|
|
|
+ anchorPoint.x,
|
|
|
|
+ anchorPoint.y
|
|
|
|
+ );
|
|
|
|
+ // let dis = SMathUtil.pointDistance(
|
|
|
|
+ // scenePoint.x,
|
|
|
|
+ // scenePoint.y,
|
|
|
|
+ // anchorPoint.x,
|
|
|
|
+ // anchorPoint.y
|
|
|
|
+ // );
|
|
|
|
+ console.log(dis)
|
|
|
|
+ if (len < 0) {
|
|
|
|
+ len = anchor.sceneDis;
|
|
|
|
+ }
|
|
|
|
+ if (dis < len) {
|
|
|
|
+ minAnchor = anchor;
|
|
|
|
+ len = dis;
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
})
|
|
})
|
|
console.log('-----------------------')
|
|
console.log('-----------------------')
|
|
console.log(minAnchor)
|
|
console.log(minAnchor)
|
|
console.log('-----------------------')
|
|
console.log('-----------------------')
|
|
- if (minAnchor&&minAnchor.parent) {
|
|
|
|
- minAnchor.parent.showAnchor = true
|
|
|
|
- }
|
|
|
|
|
|
+ // if (minAnchor&&minAnchor.parent) {
|
|
|
|
+ // minAnchor.parent.showAnchor = true
|
|
|
|
+ // }
|
|
return minAnchor;
|
|
return minAnchor;
|
|
}
|
|
}
|
|
|
|
|