|
@@ -36,48 +36,103 @@ export default class Magnifier extends Geometry {
|
|
|
if (mathUtil.equalPoint(position, coordinate.center)) {
|
|
|
mathUtil.clonePoint(this.popPosition, this.position);
|
|
|
} else {
|
|
|
- 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(
|
|
|
- coordinate.center,
|
|
|
- parallelLines.line1
|
|
|
- );
|
|
|
- let join2 = mathUtil.getJoinLinePoint(
|
|
|
- coordinate.center,
|
|
|
- parallelLines.line2
|
|
|
- );
|
|
|
+ // 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(
|
|
|
+ // coordinate.center,
|
|
|
+ // parallelLines.line1
|
|
|
+ // );
|
|
|
+ // let join2 = mathUtil.getJoinLinePoint(
|
|
|
+ // coordinate.center,
|
|
|
+ // parallelLines.line2
|
|
|
+ // );
|
|
|
|
|
|
- if (
|
|
|
- mathUtil.getDistance(join1, coordinate.center) <
|
|
|
- mathUtil.getDistance(join2, coordinate.center)
|
|
|
- ) {
|
|
|
- //this.popPosition = coordinate.getXYFromScreen(join1);
|
|
|
- this.popPosition = {
|
|
|
- x: join1.x,
|
|
|
- y: join1.y,
|
|
|
- };
|
|
|
- } else if (
|
|
|
- mathUtil.getDistance(join2, coordinate.center) <
|
|
|
- mathUtil.getDistance(join1, coordinate.center)
|
|
|
- ) {
|
|
|
- //this.popPosition = coordinate.getXYFromScreen(join2);
|
|
|
- this.popPosition = {
|
|
|
- x: join2.x,
|
|
|
- y: join2.y,
|
|
|
- };
|
|
|
- }
|
|
|
+ // if (
|
|
|
+ // mathUtil.getDistance(join1, coordinate.center) <
|
|
|
+ // mathUtil.getDistance(join2, coordinate.center)
|
|
|
+ // ) {
|
|
|
+ // //this.popPosition = coordinate.getXYFromScreen(join1);
|
|
|
+ // this.popPosition = {
|
|
|
+ // x: join1.x,
|
|
|
+ // y: join1.y,
|
|
|
+ // };
|
|
|
+ // } else if (
|
|
|
+ // mathUtil.getDistance(join2, coordinate.center) <
|
|
|
+ // mathUtil.getDistance(join1, coordinate.center)
|
|
|
+ // ) {
|
|
|
+ // //this.popPosition = coordinate.getXYFromScreen(join2);
|
|
|
+ // this.popPosition = {
|
|
|
+ // x: join2.x,
|
|
|
+ // y: join2.y,
|
|
|
+ // };
|
|
|
+ // }
|
|
|
+ this.setPopPosition();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- setPopPosition(value) {
|
|
|
- if (value) {
|
|
|
- this.popPosition = {};
|
|
|
- this.popPosition.x = value.x;
|
|
|
- this.popPosition.y = value.y;
|
|
|
+ // setPopPosition() {
|
|
|
+ // let line = mathUtil.createLine1(this.position, coordinate.center);
|
|
|
+ // let vLine = mathUtil.getVerticalLine(line, this.position);
|
|
|
+ // let parallelLines = mathUtil.getParallelLineForDistance(
|
|
|
+ // vLine,
|
|
|
+ // (distance * coordinate.zoom) / coordinate.defaultZoom
|
|
|
+ // );
|
|
|
+ // let join1 = mathUtil.getJoinLinePoint(
|
|
|
+ // coordinate.center,
|
|
|
+ // parallelLines.line1
|
|
|
+ // );
|
|
|
+ // let join2 = mathUtil.getJoinLinePoint(
|
|
|
+ // coordinate.center,
|
|
|
+ // parallelLines.line2
|
|
|
+ // );
|
|
|
+
|
|
|
+ // if (
|
|
|
+ // mathUtil.getDistance(join1, coordinate.center) <
|
|
|
+ // mathUtil.getDistance(join2, coordinate.center)
|
|
|
+ // ) {
|
|
|
+ // //this.popPosition = coordinate.getXYFromScreen(join1);
|
|
|
+ // this.popPosition = {
|
|
|
+ // x: join1.x,
|
|
|
+ // y: join1.y,
|
|
|
+ // };
|
|
|
+ // } else if (
|
|
|
+ // mathUtil.getDistance(join2, coordinate.center) <
|
|
|
+ // mathUtil.getDistance(join1, coordinate.center)
|
|
|
+ // ) {
|
|
|
+ // //this.popPosition = coordinate.getXYFromScreen(join2);
|
|
|
+ // this.popPosition = {
|
|
|
+ // x: join2.x,
|
|
|
+ // y: join2.y,
|
|
|
+ // };
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ setPopPosition() {
|
|
|
+ const position = coordinate.getScreenXY(this.position);
|
|
|
+ const center = coordinate.getScreenXY(coordinate.center);
|
|
|
+ let line = mathUtil.createLine1(position, center);
|
|
|
+ let vLine = mathUtil.getVerticalLine(line, position);
|
|
|
+ let parallelLines = mathUtil.getParallelLineForDistance(vLine, distance);
|
|
|
+ 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,
|
|
|
+ };
|
|
|
}
|
|
|
}
|
|
|
|