|
@@ -206,6 +206,10 @@ export default class Layer {
|
|
this.onMouseUp(e);
|
|
this.onMouseUp(e);
|
|
this.StorePage1 = { x: e.touches[0].pageX, y: e.touches[0].pageY };
|
|
this.StorePage1 = { x: e.touches[0].pageX, y: e.touches[0].pageY };
|
|
this.StorePage2 = { x: e.touches[1].pageX, y: e.touches[1].pageY };
|
|
this.StorePage2 = { x: e.touches[1].pageX, y: e.touches[1].pageY };
|
|
|
|
+ this.StoreMidePage = {
|
|
|
|
+ x: (this.StorePage1.x + this.StorePage2.x) / 2,
|
|
|
|
+ y: (this.StorePage1.y + this.StorePage2.y) / 2,
|
|
|
|
+ };
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
const point1 = {
|
|
const point1 = {
|
|
@@ -217,15 +221,12 @@ export default class Layer {
|
|
y: e.touches[1].pageY,
|
|
y: e.touches[1].pageY,
|
|
};
|
|
};
|
|
|
|
|
|
- // let zoom =
|
|
|
|
- // (mathUtil.getDistance(point1, point2) /
|
|
|
|
- // mathUtil.getDistance(this.StorePage1, this.StorePage2)) *
|
|
|
|
- // coordinate.zoom;
|
|
|
|
let dis1 = mathUtil.getDistance(point1, point2) / 100;
|
|
let dis1 = mathUtil.getDistance(point1, point2) / 100;
|
|
let dis2 = mathUtil.getDistance(this.StorePage1, this.StorePage2) / 100;
|
|
let dis2 = mathUtil.getDistance(this.StorePage1, this.StorePage2) / 100;
|
|
- let zoom = coordinate.zoom + dis1 - dis2;
|
|
|
|
- console.log("缩放距离:" + dis1 + "," + dis2);
|
|
|
|
- this.zoomVector(zoom);
|
|
|
|
|
|
+ let zoom = (coordinate.zoom * dis1) / dis2;
|
|
|
|
+ this.zoomVector(this.StoreMidePage, zoom);
|
|
|
|
+ mathUtil.clonePoint(this.StorePage1, point1);
|
|
|
|
+ mathUtil.clonePoint(this.StorePage2, point2);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -275,7 +276,7 @@ export default class Layer {
|
|
coordinate.center.x = coordinate.center.x - dx;
|
|
coordinate.center.x = coordinate.center.x - dx;
|
|
coordinate.center.y = coordinate.center.y + dy;
|
|
coordinate.center.y = coordinate.center.y + dy;
|
|
|
|
|
|
- dataService.setGridForPan(dx, dy);
|
|
|
|
|
|
+ dataService.setGridForPan();
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
break;
|
|
break;
|
|
case LayerEvents.AddRoad:
|
|
case LayerEvents.AddRoad:
|
|
@@ -646,11 +647,12 @@ export default class Layer {
|
|
if (e instanceof TouchEvent) {
|
|
if (e instanceof TouchEvent) {
|
|
X = this.lastX;
|
|
X = this.lastX;
|
|
Y = this.lastY;
|
|
Y = this.lastY;
|
|
|
|
+ this.StorePage1 = null;
|
|
|
|
+ this.StorePage2 = null;
|
|
|
|
+ this.StoreMidePage = null;
|
|
if (e.touches.length > 1) {
|
|
if (e.touches.length > 1) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- this.StorePage1 == null;
|
|
|
|
- this.StorePage2 == null;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
let eventName = stateService.getEventName();
|
|
let eventName = stateService.getEventName();
|
|
@@ -863,11 +865,7 @@ export default class Layer {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
coordinate.updateZoom(position, zoom);
|
|
coordinate.updateZoom(position, zoom);
|
|
- dataService.setGridForZoom(
|
|
|
|
- coordinate.width,
|
|
|
|
- coordinate.height,
|
|
|
|
- coordinate.zoom / coordinate.defaultZoom
|
|
|
|
- );
|
|
|
|
|
|
+ dataService.setGridForZoom();
|
|
this.renderer.autoRedraw();
|
|
this.renderer.autoRedraw();
|
|
}
|
|
}
|
|
|
|
|