|
@@ -1,10 +1,10 @@
|
|
|
//放大镜
|
|
|
|
|
|
-import { coordinate } from "../Coordinate.js";
|
|
|
-import { mathUtil } from "../Util/MathUtil.js";
|
|
|
-import VectorType from "../enum/VectorType.js";
|
|
|
-import Geometry from "./Geometry";
|
|
|
-import {api} from '@/store/sync.ts'
|
|
|
+import { coordinate } from '../Coordinate.js';
|
|
|
+import { mathUtil } from '../Util/MathUtil.js';
|
|
|
+import VectorType from '../enum/VectorType.js';
|
|
|
+import Geometry from './Geometry';
|
|
|
+import { api } from '@/store/sync.ts';
|
|
|
|
|
|
const distance = 500;
|
|
|
export default class Magnifier extends Geometry {
|
|
@@ -26,8 +26,8 @@ export default class Magnifier extends Geometry {
|
|
|
this.position.x = positionRaw.x;
|
|
|
this.position.y = positionRaw.y;
|
|
|
let position = {
|
|
|
- x: this.position.x,
|
|
|
- y: this.position.y,
|
|
|
+ // x: this.position.x,
|
|
|
+ // y: this.position.y,
|
|
|
};
|
|
|
//let position = coordinate.getScreenXY(this.position);
|
|
|
// let center = {
|
|
@@ -111,7 +111,7 @@ export default class Magnifier extends Geometry {
|
|
|
// };
|
|
|
// }
|
|
|
// }
|
|
|
- setPopPosition() {
|
|
|
+ setPopPosition(positionRaw) {
|
|
|
const position = coordinate.getScreenXY(this.position);
|
|
|
const center = coordinate.getScreenXY(coordinate.center);
|
|
|
let line = mathUtil.createLine1(position, center);
|
|
@@ -120,20 +120,24 @@ export default class Magnifier extends Geometry {
|
|
|
let join1 = mathUtil.getIntersectionPoint(line, parallelLines.line1);
|
|
|
let join2 = mathUtil.getIntersectionPoint(line, parallelLines.line2);
|
|
|
|
|
|
- if (
|
|
|
- mathUtil.getDistance(join1, center) < mathUtil.getDistance(join2, center)
|
|
|
- ) {
|
|
|
- this.popPosition = {
|
|
|
- x: join1.x,
|
|
|
- y: join1.y,
|
|
|
- };
|
|
|
- } else if (
|
|
|
- mathUtil.getDistance(join2, center) < mathUtil.getDistance(join1, center)
|
|
|
- ) {
|
|
|
- this.popPosition = {
|
|
|
- x: join2.x,
|
|
|
- y: join2.y,
|
|
|
- };
|
|
|
+ if (mathUtil.getDistance(join1, center) < mathUtil.getDistance(join2, center)) {
|
|
|
+ if (positionRaw) {
|
|
|
+ this.popPosition = coordinate.getScreenXY(positionRaw);
|
|
|
+ } else {
|
|
|
+ this.popPosition = {
|
|
|
+ x: join1.x,
|
|
|
+ y: join1.y,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ } else if (mathUtil.getDistance(join2, center) < mathUtil.getDistance(join1, center)) {
|
|
|
+ if (positionRaw) {
|
|
|
+ this.popPosition = coordinate.getScreenXY(positionRaw);
|
|
|
+ } else {
|
|
|
+ this.popPosition = {
|
|
|
+ x: join2.x,
|
|
|
+ y: join2.y,
|
|
|
+ };
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|