diff --git a/src/region/region-picker/circle-picker/circle-renderer.js b/src/region/region-picker/circle-picker/circle-renderer.js index c9298d3..e3c291e 100644 --- a/src/region/region-picker/circle-picker/circle-renderer.js +++ b/src/region/region-picker/circle-picker/circle-renderer.js @@ -21,6 +21,7 @@ const abbreviations = { } export default function CircleRenderer({ + id, map, onIdle = (circle) => {}, onDrag = (circle) => {}, @@ -35,13 +36,13 @@ export default function CircleRenderer({ let centerXY = project(map, center) let radius = initialRadius - const svg = select('#circle-picker').style('pointer-events', 'none') - const svgCircle = select('#circle').style('pointer-events', 'all') - const svgCircleCutout = select('#circle-cutout') - const svgHandle = select('#handle').style('pointer-events', 'all') - const svgGuideline = select('#radius-guideline') - const svgRadiusTextContainer = select('#radius-text-container') - const svgRadiusText = select('#radius-text').attr('fill-opacity', 0) + const svg = select(`#circle-picker-${id}`).style('pointer-events', 'none') + const svgCircle = select(`#circle-${id}`).style('pointer-events', 'all') + const svgCircleCutout = select(`#circle-cutout-${id}`) + const svgHandle = select(`#handle-${id}`).style('pointer-events', 'all') + const svgGuideline = select(`#radius-guideline-${id}`) + const svgRadiusTextContainer = select(`#radius-text-container-${id}`) + const svgRadiusText = select(`#radius-text-${id}`).attr('fill-opacity', 0) let guidelineAngle = 90 if (!SHOW_RADIUS_GUIDELINE) { diff --git a/src/region/region-picker/circle-picker/index.js b/src/region/region-picker/circle-picker/index.js index 96a57b3..b206d53 100644 --- a/src/region/region-picker/circle-picker/index.js +++ b/src/region/region-picker/circle-picker/index.js @@ -2,7 +2,8 @@ import React, { useState, useEffect } from 'react' import { useMapbox } from '../../../mapbox' import CircleRenderer from './circle-renderer' -const RegionPicker = ({ +const CirclePicker = ({ + id, backgroundColor, center, color, @@ -20,6 +21,7 @@ const RegionPicker = ({ useEffect(() => { const renderer = CircleRenderer({ + id, map, onIdle, onDrag, @@ -40,7 +42,7 @@ const RegionPicker = ({ return ( - - + + - + - +