/**
 * 鍒濆鍖栧涓〉闈㈢殑鍦板浘
 */
export default function () {
  const { AMap, Loca } = window;
  //椹诲嫟鐐瑰浘灞�
  const normalMap = new AMap.Map("map_container", {
    resizeEnable: true,
    rotateEnable: true,
    pitchEnable: true,
    zoom: 12,
    viewMode: "2D", //寮€鍚�2D瑙嗗浘
    buildingAnimation: true, //妤煎潡鍑虹幇鏄惁甯﹀姩鐢�
    expandZoomRange: true,
    zooms: [3, 20],
  });
  //娴烽噺鍥惧眰
  const locaMap = new AMap.Map("map_container2", {
    // features: ["bg", "road"],
    // mapStyle: "amap://styles/midnight",
    // zoom: 5,
    // viewMode: "2D",
    // skyColor: "#33216a",
    mapStyle: "amap://styles/dark",
    resizeEnable: true,
    rotateEnable: true,
    pitchEnable: true,
    zoom: 10,
    viewMode: "2D", //寮€鍚�2D瑙嗗浘
    buildingAnimation: true, //妤煎潡鍑虹幇鏄惁甯﹀姩鐢�
    expandZoomRange: true,
    zooms: [3, 20],
  });
  //浜哄憳鍥惧眰
  const personMap = new AMap.Map("map_container3", {
    mapStyle: "amap://styles/dark",
    resizeEnable: true,
    rotateEnable: true,
    pitchEnable: true,
    zoom: 10,
    viewMode: "2D", //寮€鍚�2D瑙嗗浘
    buildingAnimation: true, //妤煎潡鍑虹幇鏄惁甯﹀姩鐢�
    expandZoomRange: true,
    zooms: [3, 20],
  });
  if (AMap.ControlBar) {
    locaMap.addControl(
      new AMap.ControlBar({
        showZoomBar: false,
        showControlButton: true,
      })
    );
    normalMap.addControl(
      new AMap.ControlBar({
        showZoomBar: false,
        showControlButton: true,
      })
    );
    personMap.addControl(
      new AMap.ControlBar({
        showZoomBar: false,
        showControlButton: true,
      })
    );
  }
  let infoWindow = new AMap.InfoWindow({
    isCustom: true, //浣跨敤鑷畾涔夌獥浣�
    offset: new AMap.Pixel(16, -45),
  });
  normalMap.on("zoomchange", (info) => {
    let zoom = normalMap.getZoom(); //鑾峰彇褰撳墠鍦板浘绾у埆
    // if (zoom > 6) {
    //   for (let i = 0; i < this.state.massDataTotalPage; i++) {
    //     let index = i + 1;
    //     this.state['mass' + index].setStyle({
    //       url: 'https://a.amap.com/jsapi_demos/static/images/mass1.png',
    //       anchor: new AMap.Pixel(3, 3),
    //       size: new AMap.Size(5, 5)
    //     });
    //   }
    // } else {
    //   for (let i = 0; i < this.state.massDataTotalPage; i++) {
    //     let index = i + 1;
    //     this.state['mass' + index].setStyle({
    //       url: 'https://a.amap.com/jsapi_demos/static/images/mass1.png',
    //       anchor: new AMap.Pixel(3, 3),
    //       size: new AMap.Size(1.5, 1.5)
    //     });
    //   }
    // }
  });
  return {
    normalMap,
    locaMap,
    personMap,
    infoWindow,
  };
}