|
@@ -5,7 +5,7 @@ import { mathUtil } from "../Util/MathUtil.js";
|
|
|
import VectorType from "../enum/VectorType.js";
|
|
|
import Geometry from "./Geometry";
|
|
|
|
|
|
-const distance = 120;
|
|
|
+const distance = 500;
|
|
|
export default class Magnifier extends Geometry {
|
|
|
constructor(position, vectorId) {
|
|
|
super();
|
|
@@ -24,33 +24,51 @@ export default class Magnifier extends Geometry {
|
|
|
}
|
|
|
this.position.x = positionRaw.x;
|
|
|
this.position.y = positionRaw.y;
|
|
|
- let position = coordinate.getScreenXY(this.position);
|
|
|
- let center = {
|
|
|
- x: coordinate.width / 2,
|
|
|
- y: coordinate.height / 2,
|
|
|
+ let position = {
|
|
|
+ x: this.position.x,
|
|
|
+ y: this.position.y,
|
|
|
};
|
|
|
- if (mathUtil.equalPoint(position, center)) {
|
|
|
+ //let position = coordinate.getScreenXY(this.position);
|
|
|
+ // let center = {
|
|
|
+ // x: coordinate.width / 2,
|
|
|
+ // y: coordinate.height / 2,
|
|
|
+ // };
|
|
|
+ if (mathUtil.equalPoint(position, coordinate.center)) {
|
|
|
mathUtil.clonePoint(this.popPosition, this.position);
|
|
|
} else {
|
|
|
- let line = mathUtil.createLine1(position, center);
|
|
|
+ let line = mathUtil.createLine1(position, coordinate.center);
|
|
|
let vLine = mathUtil.getVerticalLine(line, position);
|
|
|
let parallelLines = mathUtil.getParallelLineForDistance(
|
|
|
vLine,
|
|
|
(distance * coordinate.zoom) / coordinate.defaultZoom
|
|
|
);
|
|
|
- let join1 = mathUtil.getJoinLinePoint(center, parallelLines.line1);
|
|
|
- let join2 = mathUtil.getJoinLinePoint(center, parallelLines.line2);
|
|
|
+ let join1 = mathUtil.getJoinLinePoint(
|
|
|
+ coordinate.center,
|
|
|
+ parallelLines.line1
|
|
|
+ );
|
|
|
+ let join2 = mathUtil.getJoinLinePoint(
|
|
|
+ coordinate.center,
|
|
|
+ parallelLines.line2
|
|
|
+ );
|
|
|
|
|
|
if (
|
|
|
- mathUtil.getDistance(join1, center) <
|
|
|
- mathUtil.getDistance(join2, center)
|
|
|
+ mathUtil.getDistance(join1, coordinate.center) <
|
|
|
+ mathUtil.getDistance(join2, coordinate.center)
|
|
|
) {
|
|
|
- this.popPosition = coordinate.getXYFromScreen(join1);
|
|
|
+ //this.popPosition = coordinate.getXYFromScreen(join1);
|
|
|
+ this.popPosition = {
|
|
|
+ x: join1.x,
|
|
|
+ y: join1.y,
|
|
|
+ };
|
|
|
} else if (
|
|
|
- mathUtil.getDistance(join2, center) <
|
|
|
- mathUtil.getDistance(join1, center)
|
|
|
+ mathUtil.getDistance(join2, coordinate.center) <
|
|
|
+ mathUtil.getDistance(join1, coordinate.center)
|
|
|
) {
|
|
|
- this.popPosition = coordinate.getXYFromScreen(join2);
|
|
|
+ //this.popPosition = coordinate.getXYFromScreen(join2);
|
|
|
+ this.popPosition = {
|
|
|
+ x: join2.x,
|
|
|
+ y: join2.y,
|
|
|
+ };
|
|
|
}
|
|
|
}
|
|
|
}
|