You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
3.2 KiB
1 lines
3.2 KiB
{"ast":null,"code":"import { useEffect, useRef } from 'react';\nimport { useLeafletContext } from './context.js';\nexport function createControlHook(useElement) {\n return function useLeafletControl(props) {\n const context = useLeafletContext();\n const elementRef = useElement(props, context);\n const {\n instance\n } = elementRef.current;\n const positionRef = useRef(props.position);\n const {\n position\n } = props;\n useEffect(function addControl() {\n instance.addTo(context.map);\n return function removeControl() {\n instance.remove();\n };\n }, [context.map, instance]);\n useEffect(function updateControl() {\n if (position != null && position !== positionRef.current) {\n instance.setPosition(position);\n positionRef.current = position;\n }\n }, [instance, position]);\n return elementRef;\n };\n}","map":{"version":3,"names":["useEffect","useRef","useLeafletContext","createControlHook","useElement","useLeafletControl","props","context","elementRef","instance","current","positionRef","position","addControl","addTo","map","removeControl","remove","updateControl","setPosition"],"sources":["/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/node_modules/@react-leaflet/core/lib/control.js"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport { useLeafletContext } from './context.js';\nexport function createControlHook(useElement) {\n return function useLeafletControl(props) {\n const context = useLeafletContext();\n const elementRef = useElement(props, context);\n const { instance } = elementRef.current;\n const positionRef = useRef(props.position);\n const { position } = props;\n useEffect(function addControl() {\n instance.addTo(context.map);\n return function removeControl() {\n instance.remove();\n };\n }, [\n context.map,\n instance\n ]);\n useEffect(function updateControl() {\n if (position != null && position !== positionRef.current) {\n instance.setPosition(position);\n positionRef.current = position;\n }\n }, [\n instance,\n position\n ]);\n return elementRef;\n };\n}\n"],"mappings":"AAAA,SAASA,SAAT,EAAoBC,MAApB,QAAkC,OAAlC;AACA,SAASC,iBAAT,QAAkC,cAAlC;AACA,OAAO,SAASC,iBAAT,CAA2BC,UAA3B,EAAuC;EAC1C,OAAO,SAASC,iBAAT,CAA2BC,KAA3B,EAAkC;IACrC,MAAMC,OAAO,GAAGL,iBAAiB,EAAjC;IACA,MAAMM,UAAU,GAAGJ,UAAU,CAACE,KAAD,EAAQC,OAAR,CAA7B;IACA,MAAM;MAAEE;IAAF,IAAgBD,UAAU,CAACE,OAAjC;IACA,MAAMC,WAAW,GAAGV,MAAM,CAACK,KAAK,CAACM,QAAP,CAA1B;IACA,MAAM;MAAEA;IAAF,IAAgBN,KAAtB;IACAN,SAAS,CAAC,SAASa,UAAT,GAAsB;MAC5BJ,QAAQ,CAACK,KAAT,CAAeP,OAAO,CAACQ,GAAvB;MACA,OAAO,SAASC,aAAT,GAAyB;QAC5BP,QAAQ,CAACQ,MAAT;MACH,CAFD;IAGH,CALQ,EAKN,CACCV,OAAO,CAACQ,GADT,EAECN,QAFD,CALM,CAAT;IASAT,SAAS,CAAC,SAASkB,aAAT,GAAyB;MAC/B,IAAIN,QAAQ,IAAI,IAAZ,IAAoBA,QAAQ,KAAKD,WAAW,CAACD,OAAjD,EAA0D;QACtDD,QAAQ,CAACU,WAAT,CAAqBP,QAArB;QACAD,WAAW,CAACD,OAAZ,GAAsBE,QAAtB;MACH;IACJ,CALQ,EAKN,CACCH,QADD,EAECG,QAFD,CALM,CAAT;IASA,OAAOJ,UAAP;EACH,CAzBD;AA0BH"},"metadata":{},"sourceType":"module"} |