|
@@ -221,10 +221,10 @@ export default class Layer {
|
|
// (mathUtil.getDistance(point1, point2) /
|
|
// (mathUtil.getDistance(point1, point2) /
|
|
// mathUtil.getDistance(this.StorePage1, this.StorePage2)) *
|
|
// mathUtil.getDistance(this.StorePage1, this.StorePage2)) *
|
|
// coordinate.zoom;
|
|
// coordinate.zoom;
|
|
- let zoom =
|
|
|
|
- coordinate.zoom +
|
|
|
|
- mathUtil.getDistance(point1, point2) -
|
|
|
|
- mathUtil.getDistance(this.StorePage1, this.StorePage2);
|
|
|
|
|
|
+ let dis1 = mathUtil.getDistance(point1, point2) / 100;
|
|
|
|
+ let dis2 = mathUtil.getDistance(this.StorePage1, this.StorePage2) / 100;
|
|
|
|
+ let zoom = coordinate.zoom + dis1 - dis2;
|
|
|
|
+ console.log("缩放距离:" + dis1 + "," + dis2);
|
|
this.zoomVector(zoom);
|
|
this.zoomVector(zoom);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -272,15 +272,10 @@ export default class Layer {
|
|
break;
|
|
break;
|
|
case LayerEvents.PanBackGround:
|
|
case LayerEvents.PanBackGround:
|
|
stateService.clearItems();
|
|
stateService.clearItems();
|
|
- coordinate.center.x =
|
|
|
|
- coordinate.center.x - (dx * coordinate.defaultZoom) / coordinate.zoom;
|
|
|
|
- coordinate.center.y =
|
|
|
|
- coordinate.center.y + (dy * coordinate.defaultZoom) / coordinate.zoom;
|
|
|
|
|
|
+ coordinate.center.x = coordinate.center.x - dx;
|
|
|
|
+ coordinate.center.y = coordinate.center.y + dy;
|
|
|
|
|
|
- dataService.setGridForPan(
|
|
|
|
- (dx * coordinate.defaultZoom) / coordinate.zoom,
|
|
|
|
- (dy * coordinate.defaultZoom) / coordinate.zoom
|
|
|
|
- );
|
|
|
|
|
|
+ dataService.setGridForPan(dx, dy);
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
break;
|
|
break;
|
|
case LayerEvents.AddRoad:
|
|
case LayerEvents.AddRoad:
|
|
@@ -851,16 +846,23 @@ export default class Layer {
|
|
? (e.wheelDelta / 120) * 20
|
|
? (e.wheelDelta / 120) * 20
|
|
: (-(e.detail || 0) / 3) * 20;
|
|
: (-(e.detail || 0) / 3) * 20;
|
|
const zoom = coordinate.zoom + delta;
|
|
const zoom = coordinate.zoom + delta;
|
|
- this.zoomVector(zoom);
|
|
|
|
|
|
+ let X = e.offsetX || e.layerX;
|
|
|
|
+ let Y = e.offsetY || e.layerY;
|
|
|
|
+ this.zoomVector(
|
|
|
|
+ {
|
|
|
|
+ x: X,
|
|
|
|
+ y: Y,
|
|
|
|
+ },
|
|
|
|
+ zoom
|
|
|
|
+ );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- zoomVector(zoom) {
|
|
|
|
|
|
+ zoomVector(position, zoom) {
|
|
if (zoom < minZoom || zoom > maxZoom) {
|
|
if (zoom < minZoom || zoom > maxZoom) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
-
|
|
|
|
- coordinate.updateZoom(zoom);
|
|
|
|
|
|
+ coordinate.updateZoom(position, zoom);
|
|
dataService.setGridForZoom(
|
|
dataService.setGridForZoom(
|
|
coordinate.width,
|
|
coordinate.width,
|
|
coordinate.height,
|
|
coordinate.height,
|