Skip to content

Commit

Permalink
fix: 去除 Marker 中 isDragging 属性
Browse files Browse the repository at this point in the history
  • Loading branch information
heiyexing committed Jan 25, 2024
1 parent 2d928c8 commit 7d6d8a3
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions packages/component/src/marker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export default class Marker extends EventEmitter {
private lngLat: ILngLat;
private scene: Container;
private added: boolean = false;
private isDragging = false;
private preLngLat = { lng: 0, lat: 0 };
// tslint:disable-next-line: no-empty
public getMarkerLayerContainerSize(): IMarkerContainerAndBounds | void {}
Expand Down Expand Up @@ -260,16 +259,13 @@ export default class Marker extends EventEmitter {
clickX - containerX,
clickY - containerY,
]);
this.isDragging = true;
this.mapsService.on('mousemove', this.onMarkerDragMove);
document.addEventListener('mouseup', this.onMarkerDragEnd);
this.emit('dragstart', this.lngLat);
};

private onMarkerDragMove = (e: any) => {
if (!this.isDragging) {
return;
}

const { lng: preLng, lat: preLat } = this.preLngLat;
const { lng: curLng, lat: curLat } = e.lnglat;
const newLngLat = {
Expand All @@ -282,10 +278,6 @@ export default class Marker extends EventEmitter {
};

private onMarkerDragEnd = (e: MouseEvent) => {
if (!this.isDragging) {
return;
}
this.isDragging = false;
this.mapsService.setMapStatus({
dragEnable: true,
zoomEnable: true,
Expand Down

0 comments on commit 7d6d8a3

Please sign in to comment.