Skip to content

Commit

Permalink
rm redundant
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane98c committed Feb 23, 2024
1 parent 9f142fd commit ee4b8c6
Showing 1 changed file with 5 additions and 25 deletions.
30 changes: 5 additions & 25 deletions src/region/region-picker/circle-picker/circle-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,34 +130,14 @@ export default function CircleRenderer({
onDrag(circle)
}

const onMouseUp = (e) => {
const onMouseUp = () => {
onIdle(circle)
setCursor({ draggingCircle: false })
map.off('mousemove', onMouseMove)
map.off('touchmove', onMouseMove)
map.dragPan.enable()
svgCircle.style('pointer-events', 'all')
svgHandle.style('pointer-events', 'all')
}

const onTouchMove = (e) => {
setCenter(
{
lng: e.lngLat.lng - offset.lng,
lat: e.lngLat.lat - offset.lat,
},
{
x: e.point.x,
y: e.point.y,
}
)
onDrag(circle)
}

const onTouchEnd = (e) => {
onIdle(circle)
map.off('touchmove', onTouchMove)
svgCircle.style('pointer-events', 'all')
svgHandle.style('pointer-events', 'all')
map.dragPan.enable()
svgCircle.attr('stroke-width', 1)
}

Expand All @@ -168,8 +148,8 @@ export default function CircleRenderer({
point = { x: touch.pageX, y: touch.pageY }
svgCircle.attr('stroke-width', 4)
map.dragPan.disable()
map.on('touchmove', onTouchMove)
map.once('touchend', onTouchEnd)
map.on('touchmove', onMouseMove)
map.once('touchend', onMouseUp)
} else {
point = { x: e.offsetX, y: e.offsetY }
map.on('mousemove', onMouseMove)
Expand Down

0 comments on commit ee4b8c6

Please sign in to comment.