未为标记反应传单触发dragend事件



我在像这样的反应传单中有一个标记成分

interface ElbowMarketProps {
position: LatLng;
updateLine: Function;
removeElbow: Function;
}
export const ElbowMarker = (props: ElbowMarketProps): React.ReactElement  => {
const icon = new DivIcon({className: 'line-icon'});
return <Marker 
draggable={true}
eventHandlers={ 

{
dragend: (event) => {
console.log("dragend", event); // not called
props.updateLine(props.position, event.target._latlng) 
}   

}
}
zIndexOffset={10}
position={ props.position }
icon={ icon } 
bubblingMouseEvents={false}
>
</Marker>;
}

dragend事件没有被触发,如果我把它们放在这个标记上,dblclick和drag就可以工作了。如果我在拖动事件中更新位置,标记将停止拖动,直到我在微小移动后重新单击标记。我想这是因为标记已经被重新绘制,并且不一样。标记的索引没有改变。拖动标记后,如何调用函数?

我最终使用了mouseup事件而不是dragend,它运行得很好。

最新更新