xiebin
2022-09-22 c88c7017a1e5ef46e297d579aea93cb4df83a60a
定位图标修改、提示信息优化、右键绘画提示信息失效问题
1 files modified
1 files added
22 ■■■■■ changed files
public/img/dwicon.jpeg patch | view | raw | blame | history
src/components/OpenLayersMap/index.vue 22 ●●●●● patch | view | raw | blame | history
public/img/dwicon.jpeg
src/components/OpenLayersMap/index.vue
@@ -76,8 +76,8 @@
          projection: 'EPSG:4326',
          // 设置缩放倍数
          zoom: 13,
          minZoom: 6,
          maxZoom: 20
          minZoom: 8,
          maxZoom: 19
        })
      })
      _this.lineVector = new VectorLayer({
@@ -154,15 +154,16 @@
        //点样式
        let style = new Style({
          image: new Icon({
            src: "/img/favicon.png",
            src: "/img/dwicon.jpeg",
            anchor: [0.48, 0.52],
            scale:0.5
            // imgSize: [250,320],
            scale: 0.2
          }),
        });
        feature_Point.setStyle(style);
        this.pointVector.getSource().addFeature(feature_Point);
        var center = [Number(pointLonLat.lon), Number(pointLonLat.lat)];
        var view = this.map.getView();
        let center = [Number(pointLonLat.lon), Number(pointLonLat.lat)];
        let view = this.map.getView();
        view.setZoom(16);
        view.animate({
          center: center,
@@ -193,11 +194,14 @@
      if(!_this.showTip){
        _this.showTip = true
      }
      _this.tipTitle = "单击左键开始绘画";
      _this.tipTitle = "单击左键或者右键开始绘画"
      //提示器
      $("#map").off("mousemove").mousemove(function (e) {
        _this.setTipPosition(e.offsetX, e.offsetY, 5, 5);
      });
      })
      $("#map").off("mousedown").mousedown(function () {
        _this.tipTitle = "可继续,或选择最终位置双击结束绘画"
      })
      _this.draw = new Draw({
        source: _this.lineVector.getSource(),
@@ -214,7 +218,6 @@
      _this.map.on('click', function (e) {
        // 将点坐标保存集合
        _this.coordinates.push(e.coordinate)
        _this.tipTitle = "可继续,或单击鼠标结束";
      })
      // 结束事件
      _this.draw.on('drawend', function () {
@@ -353,6 +356,7 @@
      this.map.addLayer(clusters)
    },
    // 重置图层
    clearDraw(){
      let _this = this
      _this.coordinates = []