Commit bdd0d46f by niuxiaolin

latest

parent e427699e
<input [(ngModel)]="step">
<button (click)="test(step)">test</button>
<button (click)="test(-step)">test2</button>
<div *ngIf="debug"> <div *ngIf="debug">
标注:<input id="markerText" type="text"> 标注:<input id="markerText" type="text">
theme: theme:
......
...@@ -131,6 +131,7 @@ export class MainComponent implements OnInit { ...@@ -131,6 +131,7 @@ export class MainComponent implements OnInit {
(window as any).map=this.map; (window as any).map=this.map;
this.map.setMapStyleV2({ styleJson: theme }); this.map.setMapStyleV2({ styleJson: theme });
this.map.enableScrollWheelZoom(true); this.map.enableScrollWheelZoom(true);
this.map.enableContinuousZoom()
this.map.centerAndZoom("山西省",11); this.map.centerAndZoom("山西省",11);
this.route.queryParamMap.subscribe(queryParams => { this.route.queryParamMap.subscribe(queryParams => {
this.debug = Boolean(queryParams.get("debug")) this.debug = Boolean(queryParams.get("debug"))
...@@ -260,7 +261,20 @@ export class MainComponent implements OnInit { ...@@ -260,7 +261,20 @@ export class MainComponent implements OnInit {
//标段不定位 //标段不定位
if(type!='s'){ if(type!='s'){
this.map.setViewport(points);
// this.map.setViewport(points,{
// enableAnimation:true,
// delay:5000
// });
var view = this.map.getViewport(points,{enableAnimation:true,delay:2000});
this.map.panTo(view.center,{duration:1000});
setTimeout(() => {
// this.m.dispatchWheelEvent_Chrome(document.getElementById("baidu-map"),500);
this.map.centerAndZoom(view.center,view.zoom);
//this.map.dispatchWheelEvent_Chrome
}, 1000);
} }
...@@ -275,6 +289,10 @@ export class MainComponent implements OnInit { ...@@ -275,6 +289,10 @@ export class MainComponent implements OnInit {
//设置动画效果 //设置动画效果
this.m.animationLine(points) this.m.animationLine(points)
} }
test(step){
this.m.dispatchWheelEvent_Chrome(document.getElementById("baidu-map"),step);
}
setPrj(prj: Project) { setPrj(prj: Project) {
this.http.get<any>(this.s.basePath + "/scetion/findListById/" + prj.id).subscribe(res => { this.http.get<any>(this.s.basePath + "/scetion/findListById/" + prj.id).subscribe(res => {
......
...@@ -12,7 +12,13 @@ export class SelfMapService { ...@@ -12,7 +12,13 @@ export class SelfMapService {
} }
dispatchWheelEvent_Chrome($el, delta) {
var evt = document.createEvent("MouseEvents") as any;
evt.initEvent('mousewheel', true, true);
evt.wheelDelta = delta;
$el.dispatchEvent(evt);
}
/** /**
* 转换为平滑点 * 转换为平滑点
* @param points 点 * @param points 点
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment