Angular5,Openlayers5 使您的弹出窗口(覆盖)可拖动

Angular5, Openlayers5 make your popup(overlay) draggable

我正在尝试使我的弹出窗口可拖动。我见过一些使用旧版 openlayers 的解决方案,但这些解决方案不适用于新版本。

地图:

this.map = new OlMap({
  target: 'map',
  layers: [
    new OlTileLayer({
      name: 'maplayer',
      source: new OlXYZ({
        url: 'https://api.tiles.mapbox.com/v4/mapbox.streets/{z}/{x}/{y}.png?access_token=',
        title: 'maplayer'
      })
    })
  ],
  view: this.view
});

弹出窗口:

this.popup = document.getElementById('popup');

    this.incidentOverlay = new Overlay(({
      element: this.popup,
      autoPan: true,
      autoPanAnimation: {
        duration: 250
      },
      autoPanMargin: 250,
    }));

使叠加层可拖动的最佳方法是什么

非常感谢

看看 ol-ext lib 的 ol/interaction/DragOverlay。

这里有一个例子:https://viglino.github.io/ol-ext/examples/interaction/map.interaction.dragoverlay.html