@corva/ui 3.67.0-9 → 3.68.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs-bundle/components/BICOffsetPickerDialog/components/Map/Map.css.js +1 -1
- package/cjs-bundle/components/BICOffsetPickerDialog/components/Map/Map.js +1 -1
- package/cjs-bundle/components/BICOffsetPickerDialog/components/Map/Map.js.map +1 -1
- package/cjs-bundle/components/BICOffsetPickerDialog/effects/index.js +1 -1
- package/cjs-bundle/components/BICOffsetPickerDialog/effects/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellMap/OffsetWellMap.js +1 -1
- package/cjs-bundle/components/OffsetWellMap/OffsetWellMap.js.map +1 -1
- package/cjs-bundle/components/OffsetWellMap/OffsetWellMap.module.css.js +1 -1
- package/cjs-bundle/components/OffsetWellMap/WellTooltip.module.css.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Map/Map.css.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Map/Map.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Map/Map.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/effects/index.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/effects/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.css.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/effects/index.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/effects/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/Map/OffsetWellMap/OffsetWellMap.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/MapPreloader/MapPreloader.js +1 -1
- package/cjs-bundle/components/PinnableFilters/effects/index.js +1 -1
- package/cjs-bundle/components/PinnableFilters/effects/index.js.map +1 -1
- package/cjs-bundle/componentsV2/CompletionsOffsetWellPicker/AssetFilters/useOptions.js +1 -1
- package/cjs-bundle/componentsV2/CompletionsOffsetWellPicker/CompletionsOffsetWellPicker.js +1 -1
- package/cjs-bundle/componentsV2/CompletionsOffsetWellPicker/PadsTable/PadsTableBody.js +1 -1
- package/cjs-bundle/componentsV2/CompletionsOffsetWellPicker/hooks/usePadsByRadius.js +1 -1
- package/cjs-bundle/config/index.js +1 -1
- package/cjs-bundle/config/mapbox/index.js +1 -1
- package/cjs-bundle/config/mapbox/index.js.map +1 -1
- package/cjs-bundle/config/mapboxGl/index.js +2 -0
- package/cjs-bundle/config/mapboxGl/index.js.map +1 -0
- package/cjs-bundle/config/mapboxLabelPolicy/index.js +2 -0
- package/cjs-bundle/config/mapboxLabelPolicy/index.js.map +1 -0
- package/cjs-bundle/styles/mapbox.global.css.js +1 -1
- package/components/BICOffsetPickerDialog/components/Map/Map.css.js +1 -1
- package/components/BICOffsetPickerDialog/components/Map/Map.d.ts.map +1 -1
- package/components/BICOffsetPickerDialog/components/Map/Map.js +1 -1
- package/components/BICOffsetPickerDialog/components/Map/Map.js.map +1 -1
- package/components/BICOffsetPickerDialog/effects/index.js +1 -1
- package/components/BICOffsetPickerDialog/effects/index.js.map +1 -1
- package/components/OffsetWellMap/OffsetWellMap.d.ts.map +1 -1
- package/components/OffsetWellMap/OffsetWellMap.js +1 -1
- package/components/OffsetWellMap/OffsetWellMap.js.map +1 -1
- package/components/OffsetWellMap/OffsetWellMap.module.css.js +1 -1
- package/components/OffsetWellMap/WellTooltip.module.css.js +1 -1
- package/components/OffsetWellPickerV2/components/Map/Map.css.js +1 -1
- package/components/OffsetWellPickerV2/components/Map/Map.d.ts.map +1 -1
- package/components/OffsetWellPickerV2/components/Map/Map.js +1 -1
- package/components/OffsetWellPickerV2/components/Map/Map.js.map +1 -1
- package/components/OffsetWellPickerV2/effects/index.js +1 -1
- package/components/OffsetWellPickerV2/effects/index.js.map +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.css.js +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.d.ts.map +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js.map +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/effects/index.js +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/effects/index.js.map +1 -1
- package/components/OffsetWellPickerV5/components/Map/OffsetWellMap/OffsetWellMap.d.ts.map +1 -1
- package/components/OffsetWellPickerV5/components/Map/OffsetWellMap/OffsetWellMap.js +1 -1
- package/components/OffsetWellPickerV5/components/Map/OffsetWellMap/hooks/useMapTooltipState.d.ts +1 -1
- package/components/OffsetWellPickerV5/components/Map/OffsetWellMap/hooks/useOffsetWellMapState.d.ts +1 -1
- package/components/OffsetWellPickerV5/components/MapPreloader/MapPreloader.d.ts.map +1 -1
- package/components/OffsetWellPickerV5/components/MapPreloader/MapPreloader.js +1 -1
- package/components/PinnableFilters/effects/index.js +1 -1
- package/components/PinnableFilters/effects/index.js.map +1 -1
- package/componentsV2/CompletionsOffsetWellPicker/AssetFilters/AssetFilters.d.ts +1 -1
- package/componentsV2/CompletionsOffsetWellPicker/AssetFilters/AssetFilters.d.ts.map +1 -1
- package/componentsV2/CompletionsOffsetWellPicker/AssetFilters/useOptions.d.ts +1 -1
- package/componentsV2/CompletionsOffsetWellPicker/AssetFilters/useOptions.d.ts.map +1 -1
- package/componentsV2/CompletionsOffsetWellPicker/AssetFilters/useOptions.js +1 -1
- package/componentsV2/CompletionsOffsetWellPicker/CompletionsOffsetWellPicker.js +1 -1
- package/componentsV2/CompletionsOffsetWellPicker/PadsTable/PadsTableBody.js +1 -1
- package/componentsV2/CompletionsOffsetWellPicker/hooks/__tests__/usePadsByRadius.test.d.ts +2 -0
- package/componentsV2/CompletionsOffsetWellPicker/hooks/__tests__/usePadsByRadius.test.d.ts.map +1 -0
- package/componentsV2/CompletionsOffsetWellPicker/hooks/usePadsByRadius.d.ts +1 -1
- package/componentsV2/CompletionsOffsetWellPicker/hooks/usePadsByRadius.d.ts.map +1 -1
- package/componentsV2/CompletionsOffsetWellPicker/hooks/usePadsByRadius.js +1 -1
- package/componentsV2/CompletionsOffsetWellPicker/types.d.ts +1 -1
- package/componentsV2/CompletionsOffsetWellPicker/types.d.ts.map +1 -1
- package/config/index.d.ts +2 -1
- package/config/index.d.ts.map +1 -1
- package/config/index.js +1 -1
- package/config/mapbox/index.d.ts.map +1 -1
- package/config/mapbox/index.js +1 -1
- package/config/mapbox/index.js.map +1 -1
- package/config/mapboxGl/index.d.ts +3 -0
- package/config/mapboxGl/index.d.ts.map +1 -0
- package/config/mapboxGl/index.js +2 -0
- package/config/mapboxGl/index.js.map +1 -0
- package/config/mapboxLabelPolicy/__tests__/index.test.d.ts +2 -0
- package/config/mapboxLabelPolicy/__tests__/index.test.d.ts.map +1 -0
- package/config/mapboxLabelPolicy/index.d.ts +5 -0
- package/config/mapboxLabelPolicy/index.d.ts.map +1 -0
- package/config/mapboxLabelPolicy/index.js +2 -0
- package/config/mapboxLabelPolicy/index.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/mcp-server/server.mjs +1 -1
- package/package.json +1 -2
- package/styles/mapbox.global.css +8 -1
- package/styles/mapbox.global.css.js +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require('./../../../../ext-esm/style-inject/dist/style-inject.es.js')(".Map_map__Ya53V{width:100%}.Map_mapMain__K9p4a{background-color:#414141;border-radius:4px;flex:100;height:176px;width:100%}.Map_mapFooter__ueyMi{display:flex;flex:1;flex-wrap:wrap;padding-bottom:5px;padding-top:5px}.Map_mapFooterItem__y9wgh{align-items:center;display:flex;margin-right:10px;white-space:nowrap}.Map_mapFooterItemSquare__hqWmQ{border-radius:50%;height:8px;margin-right:5px;width:8px}.Map_mapFooterItemLabel__MLQYo{color:#ccc;font-size:11px}.Map_map__Ya53V .
|
|
1
|
+
"use strict";require('./../../../../ext-esm/style-inject/dist/style-inject.es.js')(".Map_map__Ya53V{width:100%}.Map_mapMain__K9p4a{background-color:#414141;border-radius:4px;flex:100;height:176px;width:100%}.Map_mapFooter__ueyMi{display:flex;flex:1;flex-wrap:wrap;padding-bottom:5px;padding-top:5px}.Map_mapFooterItem__y9wgh{align-items:center;display:flex;margin-right:10px;white-space:nowrap}.Map_mapFooterItemSquare__hqWmQ{border-radius:50%;height:8px;margin-right:5px;width:8px}.Map_mapFooterItemLabel__MLQYo{color:#ccc;font-size:11px}.Map_map__Ya53V .mapboxgl-popup-content{background-color:#414141;border-radius:4px;box-shadow:0 5px 5px rgba(0,0,0,.2),0 3px 14px rgba(0,0,0,.12),0 8px 10px rgba(0,0,0,.14);padding:4px}.Map_map__Ya53V .mapboxgl-popup-tip{display:none}.Map_map__Ya53V .mapboxgl-ctrl-group{background:none;border:none;box-shadow:none}.Map_map__Ya53V .mapboxgl-ctrl-group button{background:#272727;border:none;border-radius:4px;height:32px;margin-top:4px;width:32px}.Map_map__Ya53V .mapboxgl-ctrl-group button .mapboxgl-ctrl-icon{filter:invert(.8)}.Map_map__Ya53V .mapboxgl-ctrl-group button:hover{background:#303030}.Map_map__Ya53V .mapboxgl-ctrl-group button:hover .mapboxgl-ctrl-icon{filter:invert(1)}"),module.exports={map:"Map_map__Ya53V",mapMain:"Map_mapMain__K9p4a",mapFooter:"Map_mapFooter__ueyMi",mapFooterItem:"Map_mapFooterItem__y9wgh",mapFooterItemSquare:"Map_mapFooterItemSquare__hqWmQ",mapFooterItemLabel:"Map_mapFooterItemLabel__MLQYo"};
|
|
2
2
|
//# sourceMappingURL=Map.css.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("
|
|
1
|
+
"use strict";var e=require("@babel/runtime/helpers/slicedToArray"),r=require("react"),t=require("react-dom"),u=require("prop-types"),a=require("lodash"),l=require("./Map.css.js"),n=require("../../../../utils/index.js");require("../../../../config/mapboxGl/index.js"),require("mapbox-gl/dist/mapbox-gl.css");var o=require("react/jsx-runtime"),i=require("mapbox-gl");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=s(e),d=s(t),f=s(u),p=s(i),m=n.mapbox.isValidCoordinates,g=[29.749907,-95.358421],v="wells-highlight",y={type:"FeatureCollection",features:[]},h=function(e){var r=c.default(e,2),t=r[0];return[r[1],t]};function b(e){var t=e.subjectWell,u=e.wells,n=e.offsetWells,i=e.radius,s=e.subjectWellMarkerSize,f=e.wellMarkerSize,b=e.coordsDataPath,w=r.useRef(null),x=r.useRef(null),j=r.useRef(null),S=r.useRef(null),M=r.useRef(),q=r.useState(!1),C=c.default(q,2),D=C[0],F=C[1],P=r.useMemo((function(){return t&&a.get(t,b)}),[t,b]);r.useEffect((function(){x.current=new p.default.Map({container:w.current,style:"mapbox://styles/mapbox/dark-v9",center:h(g),zoom:1,attributionControl:!1,scrollZoom:!1}),x.current.addControl(new p.default.NavigationControl({showCompass:!1}),"bottom-right"),x.current.on("load",(function(){x.current.addSource("radius-circle",{type:"geojson",data:y}),x.current.addLayer({id:"radius-circle",type:"fill",source:"radius-circle",paint:{"fill-color":"#03BCD4","fill-opacity":.2}}),x.current.addSource("wells",{type:"geojson",data:y}),x.current.addLayer({id:"wells",type:"circle",source:"wells",paint:{"circle-radius":["get","radius"],"circle-color":"#FFC107","circle-opacity":["get","opacity"]}}),x.current.addSource(v,{type:"geojson",data:y}),x.current.addLayer({id:v,type:"circle",source:v,paint:{"circle-radius":["get","radius"],"circle-color":"#FFC107","circle-opacity":.2}}),F(!0)}));var e=x.current;return function(){e.remove(),x.current=null,j.current=null}}),[]),r.useEffect((function(){if(x.current&&D)if(P){var e=function(e,r){for(var t=c.default(e,2),u=t[0],a=t[1],l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:64,n=[],o=r/(111320*Math.cos(u*Math.PI/180)),i=r/110574,s=0;s<=l;s+=1){var d=s/l*(2*Math.PI);n.push([a+o*Math.cos(d),u+i*Math.sin(d)])}return n}(P,1609.34*i);x.current.getSource("radius-circle").setData({type:"Feature",geometry:{type:"Polygon",coordinates:[e]}})}else x.current.getSource("radius-circle").setData(y)}),[i,P,D]);return r.useEffect((function(){var e;if(x.current&&D){var l=M.current;M.current=u,null===(e=S.current)||void 0===e||e.remove(),x.current.getSource(v).setData(y);var i=n.map((function(e){return e.id})),c=[],g={},w=new p.default.LngLatBounds;u.forEach((function(e){var r=a.get(e,b);if(r&&m(r)){var u=t&&t.id===e.id,l=i.includes(e.id),n=u?s:f,o=u||l?1:.3;g[e.id]=e,w.extend(h(r)),c.push({type:"Feature",geometry:{type:"Point",coordinates:h(r)},properties:{wellId:e.id,radius:n,opacity:o}})}})),x.current.getSource("wells").setData({type:"FeatureCollection",features:c}),j.current=c.length?w:null;var q=x.current,C=null,F=function(e){q.getCanvas().style.cursor="pointer";var t=g[e.features[0].properties.wellId];if(t&&t.id!==C){C=t.id;var u=a.get(t,b),l=document.createElement("div"),n=r.createElement((function(e){var r=e.well;return o.jsx("div",{style:{color:"#fff",background:"##414141"},children:o.jsx("span",{style:{fontSize:"11px",lineHeight:"16px"},children:a.get(r,"name")})})}),{well:t});d.default.render(n,l),S.current||(S.current=new p.default.Popup({closeButton:!1,maxWidth:"none"})),S.current.setLngLat(h(u)).setDOMContent(l).addTo(q),function(e,r){x.current.getSource(v).setData({type:"Feature",geometry:{type:"Point",coordinates:h(e)},properties:{radius:3*r}})}(u,e.features[0].properties.radius)}},P=function(){var e;C=null,q.getCanvas().style.cursor="",q.getSource(v).setData(y),null===(e=S.current)||void 0===e||e.remove()},W=function(e){null!=e&&e.point&&q.queryRenderedFeatures(e.point,{layers:[v]}).length||P()};return q.on("mousemove","wells",F),q.on("mouseleave","wells",W),q.on("mouseleave",v,P),setTimeout((function(){x.current&&j.current&&u!==l&&x.current.fitBounds(j.current)}),500),function(){q.off("mousemove","wells",F),q.off("mouseleave","wells",W),q.off("mouseleave",v,P)}}}),[t,u,n,D]),o.jsx("div",{className:l.map,children:o.jsx("div",{className:l.mapMain,ref:w})})}b.propTypes={subjectWell:f.default.shape({id:f.default.number,formation:f.default.string}),wells:f.default.arrayOf(f.default.shape({})).isRequired,offsetWells:f.default.arrayOf(f.default.shape({})),radius:f.default.number.isRequired,subjectWellMarkerSize:f.default.number,wellMarkerSize:f.default.number,coordsDataPath:f.default.string},b.defaultProps={subjectWell:null,subjectWellMarkerSize:8,wellMarkerSize:5,coordsDataPath:"settings.top_hole.coordinates",offsetWells:null};var w=r.memo(b);module.exports=w;
|
|
2
2
|
//# sourceMappingURL=Map.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Map.js","sources":["../../../../../../src/components/BICOffsetPickerDialog/components/Map/Map.js"],"sourcesContent":["import { createElement, memo, useRef, useEffect, useMemo } from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport L from 'mapbox.js';\nimport { get } from 'lodash';\n\nimport { usePrevious } from '../../effects';\n\nimport styles from './Map.css';\n\nimport { mapbox } from '~/utils';\n\nconst { isValidCoordinates } = mapbox;\n\nconst RADIUS_CIRCLE_COLOR = '#03BCD4';\nconst METERS_IN_MILE = 1609.34;\nconst DEFAULT_SUBJECT_WELL_MARKER_SIZE = 8;\nconst DEFAULT_WELL_MARKER_SIZE = 5;\nconst OFFSET_WELL_COLOR = '#FFC107';\n\nconst DEFAULT_COORDS = [29.749907, -95.358421]; // TX coordinates\n\nconst toolTip =\n () =>\n // eslint-disable-next-line react/prop-types\n ({ well }) => {\n return (\n <div style={{ color: '#fff', background: '##414141' }}>\n <span style={{ fontSize: '11px', lineHeight: '16px' }}>{get(well, 'name')}</span>\n </div>\n );\n };\n\n// eslint-disable-next-line no-unused-vars\nfunction WellsMap({\n subjectWell,\n wells,\n offsetWells,\n radius,\n subjectWellMarkerSize,\n wellMarkerSize,\n coordsDataPath,\n}) {\n const mapContainerRef = useRef(null);\n const radiusCircleRef = useRef(null);\n const markersGroupRef = useRef(null);\n const highlightMarkerRef = useRef(null);\n\n const prevWells = usePrevious(wells);\n\n const subjectWellCoords = useMemo(() => {\n return subjectWell && get(subjectWell, coordsDataPath);\n }, [subjectWell, coordsDataPath]);\n\n // NOTE: Initialize map\n useEffect(() => {\n mapContainerRef.current = L.mapbox\n .map(mapContainerRef.current, null, {\n attributionControl: false,\n scrollWheelZoom: false,\n zoomControl: false,\n })\n .setView(DEFAULT_COORDS, 1);\n\n L.control\n .zoom({\n position: 'bottomright',\n })\n .addTo(mapContainerRef.current);\n L.mapbox.styleLayer('mapbox://styles/mapbox/dark-v9').addTo(mapContainerRef.current);\n\n // NOTE: React nulls the DOM ref before deferred effect cleanup runs, so keep the map in a local\n const map = mapContainerRef.current;\n return () => {\n // NOTE: mapbox.js defers _updateMapFeedbackLink on layerremove; after remove() it crashes on the deleted control container\n map.off('layerremove');\n map.remove();\n mapContainerRef.current = null;\n radiusCircleRef.current = null;\n markersGroupRef.current = null;\n };\n }, []);\n\n // NOTE: Radius circle\n useEffect(() => {\n if (!mapContainerRef.current) {\n return;\n }\n\n // NOTE: Clean up\n if (radiusCircleRef.current) {\n mapContainerRef.current.removeLayer(radiusCircleRef.current);\n }\n\n if (!subjectWellCoords) {\n radiusCircleRef.current = null;\n return;\n }\n\n radiusCircleRef.current = L.circle(subjectWellCoords, radius * METERS_IN_MILE, {\n stroke: false,\n fill: true,\n fillOpacity: 0.2,\n fillColor: RADIUS_CIRCLE_COLOR,\n className: 'circle_500',\n });\n\n radiusCircleRef.current.addTo(mapContainerRef.current);\n }, [radius, subjectWellCoords]);\n\n const handleMouseOver = (markers, coords, r) => {\n highlightMarkerRef.current = L.circleMarker(coords, {\n radius: r * 3,\n stroke: false,\n fill: true,\n fillOpacity: 0.2,\n fillColor: OFFSET_WELL_COLOR,\n className: 'circle_highlight',\n });\n\n highlightMarkerRef.current.addEventListener('mouseout', () => {\n markersGroupRef.current.removeFrom(mapContainerRef.current);\n markersGroupRef.current = L.featureGroup(markers);\n markersGroupRef.current.addTo(mapContainerRef.current);\n\n mapContainerRef.current.closePopup();\n });\n\n const newMarkers = markers.concat(highlightMarkerRef.current);\n markersGroupRef.current = L.featureGroup(newMarkers);\n markersGroupRef.current.addTo(mapContainerRef.current);\n };\n\n // NOTE: Well markers\n useEffect(() => {\n if (!mapContainerRef.current) {\n return;\n }\n\n mapContainerRef.current.closePopup();\n\n // NOTE: Clean up\n if (markersGroupRef.current) {\n markersGroupRef.current.removeFrom(mapContainerRef.current);\n }\n\n const offsetWellIds = offsetWells.map(well => well.id);\n\n const markers = [];\n wells.forEach(well => {\n const coords = get(well, coordsDataPath);\n\n if (coords && isValidCoordinates(coords)) {\n const isWellSubject = subjectWell && subjectWell.id === well.id;\n const isWellOffset = offsetWellIds.includes(well.id);\n const r = isWellSubject ? subjectWellMarkerSize : wellMarkerSize;\n const color = OFFSET_WELL_COLOR;\n const opacity = isWellSubject || isWellOffset ? 1 : 0.3;\n\n const newMarker = L.circleMarker(coords, {\n radius: r,\n stroke: false,\n fill: true,\n fillOpacity: opacity,\n fillColor: color,\n className: 'circle_500',\n });\n\n newMarker.addEventListener('mouseover', () => {\n // Tooltip\n const tooltipContainer = document.createElement('div');\n const tootipContent = createElement(toolTip(), { well });\n ReactDOM.render(tootipContent, tooltipContainer);\n L.popup().setLatLng(coords).setContent(tooltipContainer).openOn(mapContainerRef.current);\n\n // Highlight\n handleMouseOver(markers, coords, r);\n });\n\n markers.push(newMarker);\n }\n });\n\n if (markers.length) {\n markersGroupRef.current = L.featureGroup(markers);\n markersGroupRef.current.addTo(mapContainerRef.current);\n }\n\n setTimeout(() => {\n if (radiusCircleRef.current) {\n radiusCircleRef.current.bringToBack();\n }\n\n if (mapContainerRef.current && markersGroupRef.current && wells !== prevWells) {\n mapContainerRef.current.fitBounds(markersGroupRef.current.getBounds());\n }\n }, 500);\n }, [subjectWell, wells, offsetWells]);\n\n return (\n <div className={styles.map}>\n <div className={styles.mapMain} ref={mapContainerRef} />\n </div>\n );\n}\n\nWellsMap.propTypes = {\n subjectWell: PropTypes.shape({\n id: PropTypes.number,\n formation: PropTypes.string,\n }),\n wells: PropTypes.arrayOf(PropTypes.shape({})).isRequired,\n offsetWells: PropTypes.arrayOf(PropTypes.shape({})),\n radius: PropTypes.number.isRequired,\n subjectWellMarkerSize: PropTypes.number,\n wellMarkerSize: PropTypes.number,\n coordsDataPath: PropTypes.string,\n};\n\nWellsMap.defaultProps = {\n subjectWell: null,\n subjectWellMarkerSize: DEFAULT_SUBJECT_WELL_MARKER_SIZE,\n wellMarkerSize: DEFAULT_WELL_MARKER_SIZE,\n coordsDataPath: 'settings.top_hole.coordinates',\n offsetWells: null,\n};\n\nexport default memo(WellsMap);\n"],"names":["isValidCoordinates","mapbox","DEFAULT_COORDS","WellsMap","_ref2","subjectWell","wells","offsetWells","radius","subjectWellMarkerSize","wellMarkerSize","coordsDataPath","mapContainerRef","useRef","radiusCircleRef","markersGroupRef","highlightMarkerRef","prevWells","usePrevious","subjectWellCoords","useMemo","get","useEffect","current","L","map","attributionControl","scrollWheelZoom","zoomControl","setView","control","zoom","position","addTo","styleLayer","off","remove","removeLayer","circle","stroke","fill","fillOpacity","fillColor","className","closePopup","removeFrom","offsetWellIds","well","id","markers","forEach","coords","isWellSubject","isWellOffset","includes","r","opacity","newMarker","circleMarker","addEventListener","tooltipContainer","document","createElement","tootipContent","_ref","_jsx","style","color","background","children","jsx","fontSize","lineHeight","ReactDOM","render","popup","setLatLng","setContent","openOn","featureGroup","newMarkers","concat","handleMouseOver","push","length","setTimeout","bringToBack","fitBounds","getBounds","styles","mapMain","ref","propTypes","PropTypes","shape","number","formation","string","arrayOf","isRequired","defaultProps","memo"],"mappings":"oWAYQA,EAAuBC,EAAMA,OAA7BD,mBAQFE,EAAiB,CAAC,WAAY,WAcpC,S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YAAa,MAGf,IAAe8F,EAAAA,EAAAA,KAAKlG"}
|
|
1
|
+
{"version":3,"file":"Map.js","sources":["../../../../../../src/components/BICOffsetPickerDialog/components/Map/Map.js"],"sourcesContent":["import { createElement, memo, useRef, useEffect, useMemo, useState } from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport { get } from 'lodash';\n\nimport styles from './Map.css';\n\nimport { mapbox } from '~/utils';\nimport mapboxgl from '~/config/mapboxGl';\nimport 'mapbox-gl/dist/mapbox-gl.css';\n\nconst { isValidCoordinates } = mapbox;\n\nconst RADIUS_CIRCLE_COLOR = '#03BCD4';\nconst METERS_IN_MILE = 1609.34;\nconst DEFAULT_SUBJECT_WELL_MARKER_SIZE = 8;\nconst DEFAULT_WELL_MARKER_SIZE = 5;\nconst OFFSET_WELL_COLOR = '#FFC107';\n\nconst DEFAULT_COORDS = [29.749907, -95.358421]; // TX coordinates\n\nconst RADIUS_CIRCLE_ID = 'radius-circle';\nconst WELLS_ID = 'wells';\nconst HIGHLIGHT_ID = 'wells-highlight';\nconst EMPTY_FEATURE_COLLECTION = { type: 'FeatureCollection', features: [] };\n\nconst toLngLat = ([lat, lng]) => [lng, lat];\n\n// NOTE: mapbox-gl has no geographic-radius circle primitive, so approximate it with a polygon\nconst makeCirclePolygon = ([lat, lng], radiusMeters, points = 64) => {\n const ring = [];\n const distanceX = radiusMeters / (111320 * Math.cos((lat * Math.PI) / 180));\n const distanceY = radiusMeters / 110574;\n for (let i = 0; i <= points; i += 1) {\n const theta = (i / points) * (2 * Math.PI);\n ring.push([lng + distanceX * Math.cos(theta), lat + distanceY * Math.sin(theta)]);\n }\n return ring;\n};\n\nconst toolTip =\n () =>\n // eslint-disable-next-line react/prop-types\n ({ well }) => {\n return (\n <div style={{ color: '#fff', background: '##414141' }}>\n <span style={{ fontSize: '11px', lineHeight: '16px' }}>{get(well, 'name')}</span>\n </div>\n );\n };\n\n// eslint-disable-next-line no-unused-vars\nfunction WellsMap({\n subjectWell,\n wells,\n offsetWells,\n radius,\n subjectWellMarkerSize,\n wellMarkerSize,\n coordsDataPath,\n}) {\n const mapContainerRef = useRef(null);\n const mapRef = useRef(null);\n const markersBoundsRef = useRef(null);\n const popupRef = useRef(null);\n const prevWellsRef = useRef();\n const [isMapReady, setIsMapReady] = useState(false);\n\n const subjectWellCoords = useMemo(() => {\n return subjectWell && get(subjectWell, coordsDataPath);\n }, [subjectWell, coordsDataPath]);\n\n // NOTE: Initialize map\n useEffect(() => {\n mapRef.current = new mapboxgl.Map({\n container: mapContainerRef.current,\n style: 'mapbox://styles/mapbox/dark-v9',\n center: toLngLat(DEFAULT_COORDS),\n zoom: 1,\n attributionControl: false,\n scrollZoom: false,\n });\n\n mapRef.current.addControl(\n new mapboxgl.NavigationControl({ showCompass: false }),\n 'bottom-right'\n );\n\n // NOTE: Sources/layers can only be added once the style has loaded.\n // The radius circle layer is added first so well markers render above it (was bringToBack),\n // and the hover highlight layer last so it renders on top of the markers\n mapRef.current.on('load', () => {\n mapRef.current.addSource(RADIUS_CIRCLE_ID, {\n type: 'geojson',\n data: EMPTY_FEATURE_COLLECTION,\n });\n mapRef.current.addLayer({\n id: RADIUS_CIRCLE_ID,\n type: 'fill',\n source: RADIUS_CIRCLE_ID,\n paint: {\n 'fill-color': RADIUS_CIRCLE_COLOR,\n 'fill-opacity': 0.2,\n },\n });\n\n mapRef.current.addSource(WELLS_ID, { type: 'geojson', data: EMPTY_FEATURE_COLLECTION });\n mapRef.current.addLayer({\n id: WELLS_ID,\n type: 'circle',\n source: WELLS_ID,\n paint: {\n 'circle-radius': ['get', 'radius'],\n 'circle-color': OFFSET_WELL_COLOR,\n 'circle-opacity': ['get', 'opacity'],\n },\n });\n\n mapRef.current.addSource(HIGHLIGHT_ID, { type: 'geojson', data: EMPTY_FEATURE_COLLECTION });\n mapRef.current.addLayer({\n id: HIGHLIGHT_ID,\n type: 'circle',\n source: HIGHLIGHT_ID,\n paint: {\n 'circle-radius': ['get', 'radius'],\n 'circle-color': OFFSET_WELL_COLOR,\n 'circle-opacity': 0.2,\n },\n });\n\n setIsMapReady(true);\n });\n\n const map = mapRef.current;\n return () => {\n map.remove();\n mapRef.current = null;\n markersBoundsRef.current = null;\n };\n }, []);\n\n // NOTE: Radius circle\n useEffect(() => {\n if (!mapRef.current || !isMapReady) {\n return;\n }\n\n if (!subjectWellCoords) {\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData(EMPTY_FEATURE_COLLECTION);\n return;\n }\n\n const ring = makeCirclePolygon(subjectWellCoords, radius * METERS_IN_MILE);\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData({\n type: 'Feature',\n geometry: { type: 'Polygon', coordinates: [ring] },\n });\n }, [radius, subjectWellCoords, isMapReady]);\n\n const handleMouseOver = (coords, r) => {\n // Highlight the hovered well with a bigger translucent circle\n mapRef.current.getSource(HIGHLIGHT_ID).setData({\n type: 'Feature',\n geometry: { type: 'Point', coordinates: toLngLat(coords) },\n properties: { radius: r * 3 },\n });\n };\n\n // NOTE: Well markers\n useEffect(() => {\n if (!mapRef.current || !isMapReady) {\n return undefined;\n }\n\n const prevWells = prevWellsRef.current;\n prevWellsRef.current = wells;\n\n popupRef.current?.remove();\n mapRef.current.getSource(HIGHLIGHT_ID).setData(EMPTY_FEATURE_COLLECTION);\n\n const offsetWellIds = offsetWells.map(well => well.id);\n\n const features = [];\n const wellsById = {};\n const bounds = new mapboxgl.LngLatBounds();\n wells.forEach(well => {\n const coords = get(well, coordsDataPath);\n\n if (coords && isValidCoordinates(coords)) {\n const isWellSubject = subjectWell && subjectWell.id === well.id;\n const isWellOffset = offsetWellIds.includes(well.id);\n const r = isWellSubject ? subjectWellMarkerSize : wellMarkerSize;\n const opacity = isWellSubject || isWellOffset ? 1 : 0.3;\n\n wellsById[well.id] = well;\n bounds.extend(toLngLat(coords));\n features.push({\n type: 'Feature',\n geometry: { type: 'Point', coordinates: toLngLat(coords) },\n properties: { wellId: well.id, radius: r, opacity },\n });\n }\n });\n\n mapRef.current.getSource(WELLS_ID).setData({ type: 'FeatureCollection', features });\n markersBoundsRef.current = features.length ? bounds : null;\n\n const map = mapRef.current;\n let hoveredWellId = null;\n\n const handleMouseMove = e => {\n map.getCanvas().style.cursor = 'pointer';\n\n const well = wellsById[e.features[0].properties.wellId];\n if (!well || well.id === hoveredWellId) {\n return;\n }\n hoveredWellId = well.id;\n\n const coords = get(well, coordsDataPath);\n\n // Tooltip\n const tooltipContainer = document.createElement('div');\n const tootipContent = createElement(toolTip(), { well });\n ReactDOM.render(tootipContent, tooltipContainer);\n if (!popupRef.current) {\n popupRef.current = new mapboxgl.Popup({ closeButton: false, maxWidth: 'none' });\n }\n popupRef.current.setLngLat(toLngLat(coords)).setDOMContent(tooltipContainer).addTo(map);\n\n // Highlight\n handleMouseOver(coords, e.features[0].properties.radius);\n };\n\n // NOTE: was the mouseout handler of the Leaflet highlight marker\n const handleHighlightMouseLeave = () => {\n hoveredWellId = null;\n map.getCanvas().style.cursor = '';\n map.getSource(HIGHLIGHT_ID).setData(EMPTY_FEATURE_COLLECTION);\n popupRef.current?.remove();\n };\n\n // NOTE: If the pointer exits before the highlight renders under it, the highlight\n // layer never emits mouseleave — clear here unless the cursor is inside the highlight\n const handleWellsMouseLeave = e => {\n if (e?.point && map.queryRenderedFeatures(e.point, { layers: [HIGHLIGHT_ID] }).length) {\n return;\n }\n handleHighlightMouseLeave();\n };\n\n map.on('mousemove', WELLS_ID, handleMouseMove);\n map.on('mouseleave', WELLS_ID, handleWellsMouseLeave);\n map.on('mouseleave', HIGHLIGHT_ID, handleHighlightMouseLeave);\n\n setTimeout(() => {\n if (mapRef.current && markersBoundsRef.current && wells !== prevWells) {\n mapRef.current.fitBounds(markersBoundsRef.current);\n }\n }, 500);\n\n return () => {\n map.off('mousemove', WELLS_ID, handleMouseMove);\n map.off('mouseleave', WELLS_ID, handleWellsMouseLeave);\n map.off('mouseleave', HIGHLIGHT_ID, handleHighlightMouseLeave);\n };\n }, [subjectWell, wells, offsetWells, isMapReady]);\n\n return (\n <div className={styles.map}>\n <div className={styles.mapMain} ref={mapContainerRef} />\n </div>\n );\n}\n\nWellsMap.propTypes = {\n subjectWell: PropTypes.shape({\n id: PropTypes.number,\n formation: PropTypes.string,\n }),\n wells: PropTypes.arrayOf(PropTypes.shape({})).isRequired,\n offsetWells: PropTypes.arrayOf(PropTypes.shape({})),\n radius: PropTypes.number.isRequired,\n subjectWellMarkerSize: PropTypes.number,\n wellMarkerSize: PropTypes.number,\n coordsDataPath: PropTypes.string,\n};\n\nWellsMap.defaultProps = {\n subjectWell: null,\n subjectWellMarkerSize: DEFAULT_SUBJECT_WELL_MARKER_SIZE,\n wellMarkerSize: DEFAULT_WELL_MARKER_SIZE,\n coordsDataPath: 'settings.top_hole.coordinates',\n offsetWells: null,\n};\n\nexport default memo(WellsMap);\n"],"names":["isValidCoordinates","mapbox","DEFAULT_COORDS","HIGHLIGHT_ID","EMPTY_FEATURE_COLLECTION","type","features","toLngLat","_ref","_ref2","_slicedToArray","lat","WellsMap","_ref6","subjectWell","wells","offsetWells","radius","subjectWellMarkerSize","wellMarkerSize","coordsDataPath","mapContainerRef","useRef","mapRef","markersBoundsRef","popupRef","prevWellsRef","useState","_useState2","_useState","isMapReady","setIsMapReady","subjectWellCoords","useMemo","get","useEffect","current","mapboxgl","Map","container","style","center","zoom","attributionControl","scrollZoom","addControl","NavigationControl","showCompass","on","addSource","data","addLayer","id","source","paint","map","remove","ring","_ref3","radiusMeters","_ref4","lng","points","distanceX","Math","cos","PI","distanceY","i","theta","push","sin","makeCirclePolygon","getSource","setData","geometry","coordinates","_popupRef$current","prevWells","offsetWellIds","well","wellsById","bounds","LngLatBounds","forEach","coords","isWellSubject","isWellOffset","includes","r","opacity","extend","properties","wellId","length","hoveredWellId","handleMouseMove","e","getCanvas","cursor","tooltipContainer","document","createElement","tootipContent","_ref5","_jsx","color","background","children","jsx","fontSize","lineHeight","ReactDOM","render","Popup","closeButton","maxWidth","setLngLat","setDOMContent","addTo","handleMouseOver","handleHighlightMouseLeave","_popupRef$current2","handleWellsMouseLeave","point","queryRenderedFeatures","layers","setTimeout","fitBounds","off","className","styles","mapMain","ref","propTypes","PropTypes","shape","number","formation","string","arrayOf","isRequired","defaultProps","memo"],"mappings":"qdAWQA,EAAuBC,EAAMA,OAA7BD,mBAQFE,EAAiB,CAAC,WAAY,WAI9BC,EAAe,kBACfC,EAA2B,CAAEC,KAAM,oBAAqBC,SAAU,IAElEC,EAAW,SAAHC,GAAA,IAAAC,EAAAC,EAAAA,QAAAF,EAAA,GAAKG,EAAGF,EAAA,GAAK,MAAM,CAANA,EAAA,GAAYE,EAAI,EA0B3C,SAASC,EAQNC,GAAA,IAPDC,IAAAA,YACAC,IAAAA,MACAC,IAAAA,YACAC,IAAAA,OACAC,IAAAA,sBACAC,IAAAA,eACAC,IAAAA,eAEMC,EAAkBC,SAAO,MACzBC,EAASD,SAAO,MAChBE,EAAmBF,SAAO,MAC1BG,EAAWH,SAAO,MAClBI,EAAeJ,EAAAA,SACeK,EAAAA,EAAQA,UAAC,GAAMC,EAAAlB,EAAAA,QAAAmB,EAAA,GAA5CC,EAAUF,EAAA,GAAEG,EAAaH,EAAA,GAE1BI,EAAoBC,EAAAA,SAAQ,WAChC,OAAOnB,GAAeoB,EAAAA,IAAIpB,EAAaM,EACzC,GAAG,CAACN,EAAaM,IAGjBe,EAAAA,WAAU,WACRZ,EAAOa,QAAU,IAAIC,EAAQ,QAACC,IAAI,CAChCC,UAAWlB,EAAgBe,QAC3BI,MAAO,iCACPC,OAAQlC,EAASL,GACjBwC,KAAM,EACNC,oBAAoB,EACpBC,YAAY,IAGdrB,EAAOa,QAAQS,WACb,IAAIR,EAAAA,QAASS,kBAAkB,CAAEC,aAAa,IAC9C,gBAMFxB,EAAOa,QAAQY,GAAG,QAAQ,WACxBzB,EAAOa,QAAQa,UAvEI,gBAuEwB,CACzC5C,KAAM,UACN6C,KAAM9C,IAERmB,EAAOa,QAAQe,SAAS,CACtBC,GA5Ei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time/helpers/asyncToGenerator"),t=require("@babel/runtime/helpers/slicedToArray"),r=require("@babel/runtime/regenerator"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/helpers/slicedToArray"),r=require("@babel/runtime/regenerator"),a=require("react"),u=require("lodash"),n=require("../utils/apiCalls.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=s(e),c=s(t),i=s(r);exports.useFetchBicWellsData=function(e,t){var r=a.useState([]),s=c.default(r,2),f=s[0],o=s[1];return a.useEffect((function(){var r,a=(r=l.default(i.default.mark((function t(){var r,a,s,l,f;return i.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,!e){t.next=7;break}return t.next=4,Promise.all([n.fetchBicWellSections(e)]);case 4:t.t0=t.sent,t.next=8;break;case 7:t.t0=[];case 8:a=t.t0,s=c.default(a,1),r=s[0],l=!u.isEmpty(r)&&JSON.parse(r[0].data.filters)||void 0,f=!u.isEmpty(r)&&r[0].data.result&&JSON.parse(r[0].data.result)||void 0,o({filters:l,result:f}),t.next=19;break;case 16:t.prev=16,t.t1=t.catch(0),o(null);case 19:case"end":return t.stop()}}),t,null,[[0,16]])}))),function(){return r.apply(this,arguments)});t&&a()}),[e,t]),f},exports.useWells=function(e,t){var r=a.useRef(!0),u=a.useState(null),s=c.default(u,2),f=s[0],o=s[1];return a.useEffect((function(){function a(){return(a=l.default(i.default.mark((function t(){var r;return i.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.fetchWells(e);case 2:r=t.sent,o(r);case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}t&&r.current&&(o(null),function(){a.apply(this,arguments)}(),r.current=!1)}),[e,t]),f};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/components/BICOffsetPickerDialog/effects/index.js"],"sourcesContent":["import { useEffect, useState, useRef } from 'react';\nimport { isEmpty } from 'lodash';\n\nimport { fetchWells, fetchBicWellSections } from '../utils/apiCalls';\n\nexport function usePrevious(value) {\n const ref = useRef();\n useEffect(() => {\n ref.current = value;\n });\n return ref.current;\n}\n\nexport function useWells(companyId, open) {\n const initialLoadingRef = useRef(true);\n const [wells, setWells] = useState(null);\n\n useEffect(() => {\n async function handleFetchWells() {\n const data = await fetchWells(companyId);\n setWells(data);\n }\n\n if (open && initialLoadingRef.current) {\n setWells(null);\n handleFetchWells();\n initialLoadingRef.current = false;\n }\n }, [companyId, open]);\n\n return wells;\n}\n\nexport const useFetchBicWellsData = (assetId, isOpen) => {\n const [bicData, setBicData] = useState([]);\n\n useEffect(() => {\n const handleOffsetWellBicData = async () => {\n let data;\n try {\n [data] = assetId ? await Promise.all([fetchBicWellSections(assetId)]) : [];\n const filters = (!isEmpty(data) && JSON.parse(data[0].data.filters)) || undefined;\n const result =\n (!isEmpty(data) && data[0].data.result && JSON.parse(data[0].data.result)) || undefined;\n setBicData({\n filters,\n result,\n });\n } catch (e) {\n setBicData(null);\n }\n };\n\n if (isOpen) {\n handleOffsetWellBicData();\n }\n }, [assetId, isOpen]);\n\n return bicData;\n};\n"],"names":["assetId","isOpen","useState","_useState4","_slicedToArray","_useState3","bicData","setBicData","useEffect","_ref","handleOffsetWellBicData","_asyncToGenerator","_regeneratorRuntime","mark","_callee2","data","_ref2","_ref3","filters","result","wrap","_context2","prev","next","Promise","all","fetchBicWellSections","t0","sent","isEmpty","JSON","parse","undefined","t1","stop","apply","this","arguments","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/BICOffsetPickerDialog/effects/index.js"],"sourcesContent":["import { useEffect, useState, useRef } from 'react';\nimport { isEmpty } from 'lodash';\n\nimport { fetchWells, fetchBicWellSections } from '../utils/apiCalls';\n\nexport function usePrevious(value) {\n const ref = useRef();\n useEffect(() => {\n ref.current = value;\n });\n return ref.current;\n}\n\nexport function useWells(companyId, open) {\n const initialLoadingRef = useRef(true);\n const [wells, setWells] = useState(null);\n\n useEffect(() => {\n async function handleFetchWells() {\n const data = await fetchWells(companyId);\n setWells(data);\n }\n\n if (open && initialLoadingRef.current) {\n setWells(null);\n handleFetchWells();\n initialLoadingRef.current = false;\n }\n }, [companyId, open]);\n\n return wells;\n}\n\nexport const useFetchBicWellsData = (assetId, isOpen) => {\n const [bicData, setBicData] = useState([]);\n\n useEffect(() => {\n const handleOffsetWellBicData = async () => {\n let data;\n try {\n [data] = assetId ? await Promise.all([fetchBicWellSections(assetId)]) : [];\n const filters = (!isEmpty(data) && JSON.parse(data[0].data.filters)) || undefined;\n const result =\n (!isEmpty(data) && data[0].data.result && JSON.parse(data[0].data.result)) || undefined;\n setBicData({\n filters,\n result,\n });\n } catch (e) {\n setBicData(null);\n }\n };\n\n if (isOpen) {\n handleOffsetWellBicData();\n }\n }, [assetId, isOpen]);\n\n return bicData;\n};\n"],"names":["assetId","isOpen","useState","_useState4","_slicedToArray","_useState3","bicData","setBicData","useEffect","_ref","handleOffsetWellBicData","_asyncToGenerator","_regeneratorRuntime","mark","_callee2","data","_ref2","_ref3","filters","result","wrap","_context2","prev","next","Promise","all","fetchBicWellSections","t0","sent","isEmpty","JSON","parse","undefined","t1","stop","apply","this","arguments","companyId","open","initialLoadingRef","useRef","_useState2","_useState","wells","setWells","_handleFetchWells","_callee","_context","fetchWells","current","handleFetchWells"],"mappings":"8ZAiCoC,SAACA,EAASC,GAC5C,IAA8BC,EAAAA,EAAQA,SAAC,IAAGC,EAAAC,EAAAA,QAAAC,EAAA,GAAnCC,EAAOH,EAAA,GAAEI,EAAUJ,EAAA,GAwB1B,OAtBAK,EAAAA,WAAU,WACR,IAAgCC,EAA1BC,GAA0BD,EAAAE,EAAA,QAAAC,EAAA,QAAAC,MAAA,SAAAC,IAAA,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAA,OAAAP,UAAAQ,MAAA,SAAAC,GAAA,OAAA,OAAAA,E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,EAAA1B,KAAA0B,EAAAzB,MAAA,KAAA,EAAA,OAAAyB,EAAAzB,KAAA,EACqB0B,EAAAA,WAAWX,GAAU,KAAA,EAAlCvB,EAAIiC,EAAApB,KACViB,EAAS9B,GAAM,KAAA,EAAA,IAAA,MAAA,OAAAiC,EAAAd,OAAA,GAAAa,EAChB,MAAAZ,MAAAC,KAAAC,UAAA,CAEGE,GAAQC,EAAkBU,UAC5BL,EAAS,MAPG,WACiBC,EAAAX,MAAAC,KAAAC,UAAA,CAO7Bc,GACAX,EAAkBU,SAAU,EAEhC,GAAG,CAACZ,EAAWC,IAERK,CACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/
|
|
1
|
+
"use strict";var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),l=require("react-dom"),i=require("lodash"),o=require("classnames"),c=require("@material-ui/core"),u=require("@material-ui/icons");require("mapbox-gl/dist/mapbox-gl.css");var n=require("./effects/usePreviousWells.js"),s=require("./WellTooltip.js"),a=require("./utils.js"),d=require("./OffsetWellMap.module.css.js");require("../../config/mapboxGl/index.js");var f=require("../../utils/index.js"),v=require("react/jsx-runtime"),h=require("mapbox-gl");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=m(e),p=m(r),y=m(l),w=m(o),b=m(h),j=f.mapbox.isValidCoordinates,W=[29.749907,-95.358421],x={type:"FeatureCollection",features:[]},q=["==",["id"],-1],F=function(e){var r=p.default(e,2),t=r[0];return[r[1],t]},C=function(e,r){for(var t=p.default(e,2),l=t[0],i=t[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:64,c=r/(111320*Math.cos(l*Math.PI/180)),u=r/110574,n=[],s=0;s<=o;s+=1){var a=s/o*2*Math.PI;n.push([i+c*Math.cos(a),l+u*Math.sin(a)])}return{type:"Polygon",coordinates:[n]}};module.exports=function(e){var r=e.isViewOnly,l=e.subjectWell,o=void 0===l?null:l,f=e.wells,h=e.offsetWellIds,m=e.radius,M=e.handleChanageOffsetWell,B=e.handleChangeOffsetWell,E=void 0===B?M:B,L=e.activeWellId,S=e.isClickable,D=void 0===S||S,O=e.classes,k=void 0===O?{}:O,P=t.useMemo((function(){return o&&i.get(o,"topHole.coordinates")}),[o]),R=t.useMemo((function(){return a.getAllFormations(f)}),[f]),T=t.useRef(),z=t.useRef(),I=t.useRef(),Z=t.useRef(null),N=t.useRef(null),A=t.useRef(),V=t.useRef(new Map),G=t.useRef(null),H=t.useRef(null),J=t.useState(!1),K=p.default(J,2),Q=K[0],U=K[1],X=(null==o?void 0:o.id)===L,Y=n.usePreviousWells(f),$=t.useState(!1),_=p.default($,2),ee=_[0],re=_[1],te=t.useState(3),le=p.default(te,2),ie=le[0],oe=le[1];t.useEffect((function(){var e=new b.default.Map({container:T.current,style:"mapbox://styles/mapbox/dark-v9",center:F(W),zoom:3,maxZoom:18,attributionControl:!1,scrollZoom:!1,doubleClickZoom:!1});return z.current=e,e.on("zoomend",(function(){return oe(Math.round(e.getZoom()))})),e.on("load",(function(){e.addSource("radius-circle",{type:"geojson",data:x}),e.addLayer({id:"radius-circle-fill",type:"fill",source:"radius-circle",paint:{"fill-color":"#03BCD4","fill-opacity":.2}}),e.addSource("wells",{type:"geojson",data:x}),e.addLayer({id:"wells-halo",type:"circle",source:"wells",filter:["==",["get","isOffsetWell"],!0],paint:{"circle-radius":12,"circle-color":["get","color"],"circle-opacity":.08}}),e.addLayer({id:"wells-circle",type:"circle",source:"wells",layout:{"circle-sort-key":["get","order"]},paint:{"circle-radius":5,"circle-color":["get","color"],"circle-opacity":["get","opacity"]}}),e.addLayer({id:"wells-active-highlight",type:"circle",source:"wells",filter:["==",["get","isActive"],!0],paint:{"circle-radius":12,"circle-color":["get","color"],"circle-opacity":.24}}),e.addLayer({id:"wells-hover-highlight",type:"circle",source:"wells",filter:q,paint:{"circle-radius":["case",["get","isSubjectWell"],5,12],"circle-color":["case",["get","isSubjectWell"],"#63EFFF",["get","color"]],"circle-opacity":.24}}),re(!0)})),function(){e.remove(),z.current=null,I.current=null,A.current=null,Z.current=null,N.current=null}}),[]),t.useEffect((function(){var e,r,t,l,i,o,c;Z.current=P&&m?(e=P,r=1609.34*m,t=p.default(e,2),l=t[0],i=t[1],o=r/(111320*Math.cos(l*Math.PI/180)),[[i-o,l-(c=r/110574)],[i+o,l+c]]):null;var u=z.current;u&&ee&&u.getSource("radius-circle").setData(P&&m?{type:"Feature",properties:{},geometry:C(P,1609.34*m)}:x)}),[m,P,ee]);var ce=function(e,l,o,c){var u=document.createElement("div"),n=t.createElement(s.WellTooltip(),{isViewOnly:r,well:e,color:i.get(R,e.formation,"#BDBDBD"),isOffsetWell:l,isSubjectWell:o,isClickable:D});y.default.render(v.jsx(v.Fragment,{children:n}),u),I.current||(I.current=new b.default.Popup({closeButton:!1,offset:12})),I.current.setLngLat(F(c)).setDOMContent(u).addTo(z.current)};t.useEffect((function(){var e=z.current;e&&ee&&e.setPaintProperty("wells-circle","circle-color",Q?["case",["get","isSubjectWell"],"#63EFFF",["get","color"]]:["get","color"])}),[Q,ee]),t.useEffect((function(){var e;if(f&&h){null===(e=I.current)||void 0===e||e.remove();var t=[],l=[];f.forEach((function(e){e.id!==(null==o?void 0:o.id)&&(h.includes(e.id)?t.push(e):l.push(e))}));var c=[].concat(l,t,[o]),u=[],n=new b.default.LngLatBounds;V.current.clear(),G.current=null,c.forEach((function(e,r){var t,l=null==e||null===(t=e.topHole)||void 0===t?void 0:t.coordinates;if(l&&j(l)){var c=(null==o?void 0:o.id)===e.id,s=h.includes(e.id)&&!c,a=c?"#03BCD4":i.get(R,e.formation,"#BDBDBD"),d=s?.7:.3;u.push({type:"Feature",id:r,geometry:{type:"Point",coordinates:F(l)},properties:{color:a,opacity:c?1:d,isSubjectWell:c,isOffsetWell:s,isActive:e.id===L&&!X,order:r}}),V.current.set(r,{well:e,coords:l,isOffsetWell:s,isSubjectWell:c}),c&&(G.current=r),n.extend(F(l))}})),N.current=u.length?n:null;var s=z.current;if(s&&ee){s.getSource("wells").setData({type:"FeatureCollection",features:u}),s.setFilter("wells-hover-highlight",q),H.current=null;var a=function(e){var r,t=null===(r=e.features)||void 0===r?void 0:r[0];if(t&&H.current!==t.id){var l=V.current.get(t.id);l&&(H.current=t.id,s.getCanvas().style.cursor="pointer",s.setFilter("wells-hover-highlight",["==",["id"],t.id]),ce(l.well,l.isOffsetWell,l.isSubjectWell,l.coords),l.isSubjectWell&&U(!0))}},d=function(e){var r;if(null==e||!e.point||!s.queryRenderedFeatures(e.point,{layers:["wells-circle","wells-hover-highlight"]}).length){var t=null!==H.current&&H.current===G.current;H.current=null,s.getCanvas().style.cursor="",s.setFilter("wells-hover-highlight",q),null===(r=I.current)||void 0===r||r.remove(),t&&U(!1)}},v=function(e){var t,l;if(!r){var i=V.current.get(null===(t=e.features)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.id);i&&E(i.well,!i.isOffsetWell)}};return s.on("mousemove","wells-circle",a),s.on("mouseleave","wells-circle",d),s.on("mouseleave","wells-hover-highlight",d),s.on("click","wells-circle",v),setTimeout((function(){m<3e3&&z.current&&Z.current&&f!==Y&&z.current.fitBounds(Z.current,{padding:5})}),500),function(){s.off("mousemove","wells-circle",a),s.off("mouseleave","wells-circle",d),s.off("mouseleave","wells-hover-highlight",d),s.off("click","wells-circle",v)}}}}),[o,f,h,L,ee]),t.useEffect((function(){var e=z.current;if(A.current&&(A.current.remove(),A.current=null),e&&P){var r=Q||X,t=document.createElement("img");t.src=r?"/static/media/5e9c4959259cb12c11b2c5eaf27eb3ad.svg":"/static/media/9efe5882f31d2f22bd57af92069d0a3e.svg";var l=r?[70,20]:[62,12],i=p.default(l,2),c=i[0],u=i[1],n=r?[35,29]:[31,25],s=p.default(n,2),a=s[0],d=s[1];t.width=c,t.height=u,t.addEventListener("mouseover",(function(){U(!0),null!==G.current&&e.getLayer("wells-hover-highlight")&&(H.current=G.current,e.setFilter("wells-hover-highlight",["==",["id"],G.current])),ce(o,!1,!0,P)})),t.addEventListener("mouseout",(function(){var r;H.current=null,e.getLayer("wells-hover-highlight")&&e.setFilter("wells-hover-highlight",q),null===(r=I.current)||void 0===r||r.remove(),U(!1)})),A.current=new b.default.Marker({element:t,anchor:"center",offset:[c/2-a,u/2-d]}).setLngLat(F(P)).addTo(e)}}),[Q,P,m,o,X]),t.useEffect((function(){m>3e3?z.current.setZoom(1):setTimeout((function(){o?z.current&&Z.current&&m&&z.current.fitBounds(Z.current,{padding:5}):z.current&&N.current&&z.current.fitBounds(N.current),P&&z.current&&z.current.easeTo({center:F(P),duration:700})}),500)}),[m,o,P]);var ue=function(){z.current.setZoom(ie+1)};return v.jsx("div",{className:w.default(d.mapView,k.root),children:v.jsx("div",{className:w.default(d.mapMain,k.map),ref:T,onDoubleClick:ue,children:v.jsxs("div",{className:d.zoomGroup,children:[v.jsx(c.Tooltip,{title:ie<18?"Zoom in":"",placement:"left",children:v.jsx("div",{className:w.default(d.zoomButton,g.default({},d.zoomDisabled,18===ie)),onClick:ue,children:v.jsx(u.Add,{className:d.zoomInOutIcon})})}),v.jsx(c.Tooltip,{title:ie>1?"Zoom out":"",placement:"left",children:v.jsx("div",{className:w.default(d.zoomButton,g.default({},d.zoomDisabled,1===ie)),onClick:function(){ie>1&&z.current.setZoom(ie-1)},children:v.jsx(u.Remove,{className:d.zoomInOutIcon})})})]})})})};
|
|
2
2
|
//# sourceMappingURL=OffsetWellMap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OffsetWellMap.js","sources":["../../../../src/components/OffsetWellMap/OffsetWellMap.js"],"sourcesContent":["import { createElement, useRef, useEffect, useState, useMemo } from 'react';\nimport ReactDOM from 'react-dom';\nimport { get } from 'lodash';\nimport classNames from 'classnames';\nimport { Tooltip } from '@material-ui/core';\nimport { Add as ZoomInIcon, Remove as ZoomOutIcon } from '@material-ui/icons';\nimport L from 'mapbox.js';\n\nimport SubjectWellIcon from './CustomIcon/SubjectWellIcon.svg';\nimport SubjectHighlightWellIcon from './CustomIcon/SubjectHighlightWellIcon.svg';\nimport { usePreviousWells } from './effects';\nimport { WellTooltip } from './WellTooltip';\nimport { getAllFormations } from './utils';\n\nimport styles from './OffsetWellMap.module.css';\n\nimport { mapbox } from '~/utils';\n\nconst { isValidCoordinates } = mapbox;\nconst DEFAULT_COORDS = [29.749907, -95.358421];\nconst WELL_MARKER_SIZE = 5;\nconst HIGHLIGHT_MARKER_SIZE = 12;\nconst OFFSET_WELL_COLOR = '#03BCD4';\nconst RADIUS_CIRCLE_COLOR = '#03BCD4';\nconst HIGHLIGHT_WELL_COLOR = '#63EFFF';\nconst METERS_IN_MILE = 1609.34;\nconst ZOOM_INIT_VALUE = 3;\nconst ZOOM_MAX_VALUE = 18;\nconst ZOOM_MIN_VALUE = 1;\nconst MAX_RADIUS = 3000;\n\nconst bounds = ['_renderer', '_bounds', 'min'];\n\n/** @type {React.FC<import('./OffsetWellMapProps').OffsetWellMapProps>} */\nconst OffsetWellMap = ({\n isViewOnly,\n subjectWell = null,\n wells,\n offsetWellIds,\n radius,\n handleChanageOffsetWell,\n handleChangeOffsetWell = handleChanageOffsetWell,\n activeWellId,\n isClickable = true,\n classes = {},\n}) => {\n const subjectWellCoords = useMemo(() => {\n return subjectWell && get(subjectWell, 'topHole.coordinates');\n }, [subjectWell]);\n const formationColors = useMemo(() => getAllFormations(wells), [wells]);\n\n const mapRef = useRef();\n const radiusCircleRef = useRef();\n const subjectIconRef = useRef();\n const markersGroupRef = useRef();\n const highlightMarkerRef = useRef(null);\n const [isSubjectWellHovered, setIsSubjectWellHovered] = useState(false);\n const wellMarkers = useRef();\n const subjectWellMarker = useRef();\n const isActiveWellIsSubjectWell = subjectWell?.id === activeWellId;\n const prevWells = usePreviousWells(wells);\n const [initBounds, setInitBounds] = useState(null);\n const [zoom, setZoom] = useState(ZOOM_INIT_VALUE);\n\n const markerMap = useRef(new Map());\n const prevOffsetWellIds = useRef([]);\n const prevActiveWellId = useRef(null);\n\n // NOTE: Initialize map\n useEffect(() => {\n mapRef.current = L.mapbox\n .map(mapRef.current, null, {\n attributionControl: false,\n scrollWheelZoom: false,\n zoomControl: false,\n })\n .setView(DEFAULT_COORDS, ZOOM_INIT_VALUE)\n .on('zoomend', () => setZoom(mapRef.current.getZoom()));\n mapRef.current.doubleClickZoom.disable();\n\n L.mapbox.styleLayer('mapbox://styles/mapbox/dark-v9').addTo(mapRef.current);\n\n // NOTE: React nulls the DOM ref before deferred effect cleanup runs, so keep the map in a local\n const map = mapRef.current;\n return () => {\n // NOTE: mapbox.js defers _updateMapFeedbackLink on layerremove; after remove() it crashes on the deleted control container\n map.off('layerremove');\n map.remove();\n mapRef.current = null;\n radiusCircleRef.current = null;\n markersGroupRef.current = null;\n };\n }, []);\n\n // NOTE: Radius circle\n useEffect(() => {\n if (!mapRef.current) {\n return;\n }\n\n // NOTE: Clean up\n if (radiusCircleRef.current) {\n mapRef.current.removeLayer(radiusCircleRef.current);\n radiusCircleRef.current = null;\n }\n if (subjectIconRef.current) {\n mapRef.current.removeLayer(subjectIconRef.current);\n }\n\n if (!subjectWellCoords) {\n radiusCircleRef.current = null;\n subjectIconRef.current = null;\n return;\n }\n\n if (radius) {\n radiusCircleRef.current = L.circle(subjectWellCoords, radius * METERS_IN_MILE, {\n stroke: false,\n fill: true,\n fillOpacity: 0.2,\n fillColor: RADIUS_CIRCLE_COLOR,\n className: 'circle_500',\n });\n\n radiusCircleRef.current.addTo(mapRef.current);\n }\n }, [radius, subjectWellCoords]);\n\n // NOTE: Highlight marker\n const handleHighlightMarker = (\n currentMarker,\n coords,\n color,\n well,\n isOffsetWell,\n isSubjectWell\n ) => {\n if (isSubjectWell) {\n currentMarker.setStyle({ fillColor: HIGHLIGHT_WELL_COLOR });\n setIsSubjectWellHovered(true);\n }\n\n highlightMarkerRef.current = L.circleMarker(coords, {\n radius: isSubjectWell ? WELL_MARKER_SIZE : HIGHLIGHT_MARKER_SIZE,\n stroke: false,\n fill: true,\n fillOpacity: 0.24,\n fillColor: isSubjectWell ? HIGHLIGHT_WELL_COLOR : color,\n className: 'circle_highlight',\n });\n\n highlightMarkerRef.current.addEventListener('mouseout', () => {\n markersGroupRef.current.removeFrom(mapRef.current);\n markersGroupRef.current = L.featureGroup(wellMarkers.current);\n markersGroupRef.current.addTo(mapRef.current);\n mapRef.current.closePopup();\n if (isSubjectWell) {\n currentMarker.setStyle({ fillColor: OFFSET_WELL_COLOR });\n setIsSubjectWellHovered(false);\n }\n });\n\n highlightMarkerRef.current.addEventListener('click', () => {\n if (isViewOnly) return;\n if (isOffsetWell) {\n handleChangeOffsetWell(well, false);\n } else {\n handleChangeOffsetWell(well, true);\n }\n });\n\n const newMarkers = wellMarkers.current.concat(highlightMarkerRef.current);\n markersGroupRef.current.removeFrom(mapRef.current);\n markersGroupRef.current = L.featureGroup(newMarkers);\n markersGroupRef.current.addTo(mapRef.current);\n };\n\n const showTooltip = (well, isOffsetWell, isSubjectWell, coords, offset) => {\n const popUpContainer = document.createElement('div');\n const popUpContent = createElement(WellTooltip(), {\n isViewOnly,\n well,\n color: get(formationColors, well.formation, '#BDBDBD'),\n isOffsetWell,\n isSubjectWell,\n offset,\n isClickable,\n });\n ReactDOM.render(<>{popUpContent}</>, popUpContainer);\n L.popup().setLatLng(coords).setContent(popUpContainer).openOn(mapRef.current);\n };\n\n // NOTE: Well markers\n useEffect(() => {\n if (!mapRef.current || !wells || !offsetWellIds) {\n return;\n }\n\n mapRef.current.closePopup();\n\n const currentOffsetSet = new Set(offsetWellIds);\n const prevOffsetSet = new Set(prevOffsetWellIds.current);\n const onlyOffsetStatusChanged =\n wells === prevWells &&\n prevActiveWellId.current === activeWellId &&\n wells.every(well => well.id) &&\n currentOffsetSet.size === prevOffsetSet.size;\n\n if (onlyOffsetStatusChanged) {\n // only change markers that changed offset status\n const changedWells = wells.filter(well => {\n const wasOffset = prevOffsetSet.has(well.id);\n const isOffset = currentOffsetSet.has(well.id);\n return wasOffset !== isOffset && well.id !== subjectWell?.id;\n });\n\n if (changedWells.length > 0 && changedWells.length < 10) {\n changedWells.forEach(well => {\n const existingMarker = markerMap.current.get(well.id);\n if (existingMarker) {\n const isOffsetWell = offsetWellIds.includes(well.id);\n const color = get(formationColors, well.formation, '#BDBDBD');\n const opacity = isOffsetWell ? 0.7 : 0.3;\n\n existingMarker.setStyle({\n fillOpacity: opacity,\n fillColor: color,\n });\n }\n });\n\n prevOffsetWellIds.current = [...offsetWellIds];\n prevActiveWellId.current = activeWellId;\n return;\n }\n }\n\n // NOTE: Clean up\n if (markersGroupRef.current) {\n markersGroupRef.current.removeFrom(mapRef.current);\n }\n markerMap.current.clear();\n\n const markers = [];\n const offsetWells = [];\n const unSelectedWells = [];\n wells.forEach(well => {\n if (well.id !== subjectWell?.id) {\n if (offsetWellIds.includes(well.id)) {\n offsetWells.push(well);\n } else {\n unSelectedWells.push(well);\n }\n }\n });\n const sortedWells = [...unSelectedWells, ...offsetWells, subjectWell];\n sortedWells.forEach(well => {\n const coords = well?.topHole?.coordinates;\n\n if (coords && isValidCoordinates(coords)) {\n const isSubjectWell = subjectWell?.id === well.id;\n const isOffsetWell = offsetWellIds.includes(well.id) && !isSubjectWell;\n const color = isSubjectWell\n ? OFFSET_WELL_COLOR\n : get(formationColors, well.formation, '#BDBDBD');\n const opacity = isOffsetWell ? 0.7 : 0.3;\n\n if (isOffsetWell) {\n const newHighlightMarker = L.circleMarker(coords, {\n radius: HIGHLIGHT_MARKER_SIZE,\n stroke: false,\n fill: true,\n fillColor: color,\n className: 'circle_500',\n fillOpacity: 0.08,\n });\n markers.push(newHighlightMarker);\n }\n\n const newMarker = L.circleMarker(coords, {\n radius: WELL_MARKER_SIZE,\n stroke: false,\n fill: true,\n fillOpacity: isSubjectWell ? 1 : opacity,\n fillColor: color,\n className: 'circle_500',\n });\n\n newMarker.addEventListener('mouseover', e => {\n let offset = [0, 0];\n if (initBounds && get(e.target, bounds)) {\n offset = [\n get(e.target, bounds).x - initBounds.x,\n get(e.target, bounds).y - initBounds.y,\n ];\n }\n showTooltip(well, isOffsetWell, isSubjectWell, coords, offset);\n\n // Highlight\n handleHighlightMarker(newMarker, coords, color, well, isOffsetWell, isSubjectWell);\n });\n\n if (isSubjectWell) {\n subjectWellMarker.current = newMarker;\n }\n\n if (well.id) {\n markerMap.current.set(well.id, newMarker);\n }\n\n markers.push(newMarker);\n\n if (well.id === activeWellId && !isActiveWellIsSubjectWell) {\n const highlightMarker = L.circleMarker(coords, {\n radius: HIGHLIGHT_MARKER_SIZE,\n stroke: false,\n fill: true,\n fillOpacity: 0.24,\n fillColor: color,\n className: 'circle_1200',\n });\n markers.push(highlightMarker);\n }\n }\n });\n\n if (markers.length) {\n markersGroupRef.current = L.featureGroup(markers);\n markersGroupRef.current.addTo(mapRef.current);\n }\n wellMarkers.current = markers;\n\n prevOffsetWellIds.current = [...offsetWellIds];\n prevActiveWellId.current = activeWellId;\n\n setTimeout(() => {\n if (radiusCircleRef.current) {\n radiusCircleRef.current.bringToBack();\n }\n\n if (radius < MAX_RADIUS && mapRef.current && radiusCircleRef.current && wells !== prevWells) {\n mapRef.current.fitBounds(radiusCircleRef.current.getBounds(), { padding: [5, 5] });\n }\n }, 500);\n }, [subjectWell, wells, offsetWellIds, initBounds]);\n\n // NOTE: Subject Well Icon\n\n useEffect(() => {\n if (!isSubjectWellHovered) return;\n if (get(mapRef.current, bounds) && initBounds) {\n const offset = [\n get(mapRef.current, bounds).x - initBounds.x,\n get(mapRef.current, bounds).y - initBounds.y,\n ];\n showTooltip(subjectWell, false, true, subjectWellCoords, offset);\n }\n }, [isSubjectWellHovered, initBounds, subjectWell, subjectWellCoords]);\n\n useEffect(() => {\n if (!mapRef.current || !subjectWellCoords) return;\n\n if (subjectIconRef.current) {\n subjectIconRef.current.removeFrom(mapRef.current);\n }\n\n const icon = L.icon({\n iconUrl:\n isSubjectWellHovered || isActiveWellIsSubjectWell\n ? SubjectHighlightWellIcon\n : SubjectWellIcon,\n iconSize: isSubjectWellHovered || isActiveWellIsSubjectWell ? [70, 20] : [62, 12],\n iconAnchor: isSubjectWellHovered || isActiveWellIsSubjectWell ? [35, 29] : [31, 25],\n className: 'dot',\n });\n subjectIconRef.current = L.marker(subjectWellCoords, { icon });\n subjectIconRef.current.addTo(mapRef.current);\n\n if (subjectWellMarker.current) {\n subjectIconRef.current.addEventListener('mouseover', () => {\n setIsSubjectWellHovered(true);\n\n handleHighlightMarker(\n subjectWellMarker.current,\n subjectWellCoords,\n OFFSET_WELL_COLOR,\n subjectWell,\n true,\n true\n );\n });\n\n subjectIconRef.current.addEventListener('mouseout', () => {\n markersGroupRef.current.removeFrom(mapRef.current);\n markersGroupRef.current = L.featureGroup(wellMarkers.current);\n markersGroupRef.current.addTo(mapRef.current);\n mapRef.current.closePopup();\n subjectWellMarker.current.setStyle({ fillColor: OFFSET_WELL_COLOR });\n setIsSubjectWellHovered(false);\n });\n }\n }, [\n isSubjectWellHovered,\n subjectWellCoords,\n radius,\n subjectWell,\n isActiveWellIsSubjectWell,\n initBounds,\n ]);\n\n // NOTE: Map Update\n useEffect(() => {\n if (radius > MAX_RADIUS) {\n mapRef.current.setZoom(1);\n return;\n }\n setTimeout(() => {\n if (radiusCircleRef.current) {\n radiusCircleRef.current.bringToBack();\n }\n if (subjectWell) {\n if (mapRef.current && radiusCircleRef.current && radius) {\n mapRef.current.fitBounds(radiusCircleRef.current.getBounds(), {\n padding: [5, 5],\n });\n }\n } else if (mapRef.current && markersGroupRef.current) {\n mapRef.current.fitBounds(markersGroupRef.current.getBounds());\n }\n if (subjectWellCoords && mapRef.current) {\n mapRef.current.panTo(subjectWellCoords, {\n duration: 0.7,\n easeLinearity: 0.25,\n });\n }\n if (get(mapRef.current, bounds)) {\n setInitBounds(get(mapRef.current, bounds));\n }\n }, 500);\n }, [radius, subjectWell, subjectWellCoords]);\n\n const handleZoomIn = () => {\n mapRef.current.setZoom(zoom + 1);\n };\n\n const handleZoomOut = () => {\n if (zoom > 1) {\n mapRef.current.setZoom(zoom - 1);\n }\n };\n\n return (\n <div className={classNames(styles.mapView, classes.root)}>\n <div\n className={classNames(styles.mapMain, classes.map)}\n ref={mapRef}\n onDoubleClick={handleZoomIn}\n >\n <div className={styles.zoomGroup}>\n <Tooltip title={zoom < ZOOM_MAX_VALUE ? 'Zoom in' : ''} placement=\"left\">\n <div\n className={classNames(styles.zoomButton, {\n [styles.zoomDisabled]: zoom === ZOOM_MAX_VALUE,\n })}\n onClick={handleZoomIn}\n >\n <ZoomInIcon className={styles.zoomInOutIcon} />\n </div>\n </Tooltip>\n <Tooltip title={zoom > ZOOM_MIN_VALUE ? 'Zoom out' : ''} placement=\"left\">\n <div\n className={classNames(styles.zoomButton, {\n [styles.zoomDisabled]: zoom === ZOOM_MIN_VALUE,\n })}\n onClick={handleZoomOut}\n >\n <ZoomOutIcon className={styles.zoomInOutIcon} />\n </div>\n </Tooltip>\n </div>\n </div>\n </div>\n );\n};\n\nexport default OffsetWellMap;\n"],"names":["isValidCoordinates","mapbox","DEFAULT_COORDS","bounds","_ref","isViewOnly","_ref$subjectWell","subjectWell","wells","offsetWellIds","radius","handleChanageOffsetWell","_ref$handleChangeOffs","handleChangeOffsetWell","activeWellId","_ref$isClickable","isClickable","_ref$classes","classes","subjectWellCoords","useMemo","get","formationColors","getAllFormations","mapRef","useRef","radiusCircleRef","subjectIconRef","markersGroupRef","highlightMarkerRef","useState","_useState2","_slicedToArray","_useState","isSubjectWellHovered","setIsSubjectWellHovered","wellMarkers","subjectWellMarker","isActiveWellIsSubjectWell","id","prevWells","usePreviousWells","_useState4","_useState3","initBounds","setInitBounds","_useState6","_useState5","zoom","setZoom","markerMap","Map","prevOffsetWellIds","prevActiveWellId","useEffect","current","L","map","attributionControl","scrollWheelZoom","zoomControl","setView","on","getZoom","doubleClickZoom","disable","styleLayer","addTo","off","remove","removeLayer","circle","stroke","fill","fillOpacity","fillColor","className","handleHighlightMarker","currentMarker","coords","color","well","isOffsetWell","isSubjectWell","setStyle","circleMarker","addEventListener","removeFrom","featureGroup","closePopup","newMarkers","concat","showTooltip","offset","popUpContainer","document","createElement","popUpContent","WellTooltip","formation","ReactDOM","render","_jsx","jsx","_Fragment","children","popup","setLatLng","setContent","openOn","currentOffsetSet","Set","prevOffsetSet","every","size","changedWells","filter","has","length","forEach","existingMarker","includes","opacity","clear","markers","offsetWells","unSelectedWells","push","_well$topHole","topHole","coordinates","newHighlightMarker","newMarker","e","target","x","y","set","highlightMarker","setTimeout","bringToBack","fitBounds","getBounds","padding","icon","iconUrl","iconSize","iconAnchor","marker","panTo","duration","easeLinearity","handleZoomIn","classNames","styles","mapView","root","mapMain","ref","onDoubleClick","_jsxs","jsxs","zoomGroup","Tooltip","title","placement","zoomButton","_defineProperty","zoomDisabled","onClick","ZoomInIcon","zoomInOutIcon","ZoomOutIcon"],"mappings":"2pBAkBQA,EAAuBC,EAAMA,OAA7BD,mBACFE,EAAiB,CAAC,WAAY,WAY9BC,EAAS,CAAC,YAAa,UAAW,sBAGlB,SAWhBC,GAAA,IAVJC,IAAAA,WAAUC,EAAAF,EACVG,YAAAA,aAAc,KAAID,EAClBE,IAAAA,MACAC,IAAAA,cACAC,IAAAA,OACAC,IAAAA,wBAAuBC,EAAAR,EACvBS,uBAAAA,aAAyBF,EAAuBC,EAChDE,IAAAA,aAAYC,EAAAX,EACZY,YAAAA,cAAkBD,EAAAE,EAAAb,EAClBc,QAAAA,OAAO,IAAAD,EAAG,CAAA,EAAEA,EAENE,EAAoBC,EAAAA,SAAQ,WAChC,OAAOb,GAAec,EAAAA,IAAId,EAAa,sBACzC,GAAG,CAACA,IACEe,EAAkBF,EAAAA,SAAQ,WAAA,OAAMG,EAAAA,iBAAiBf,KAAQ,CAACA,IAE1DgB,EAASC,EAAAA,SACTC,EAAkBD,EAAAA,SAClBE,EAAiBF,EAAAA,SACjBG,EAAkBH,EAAAA,SAClBI,EAAqBJ,SAAO,MACsBK,EAAAA,EAAQA,UAAC,GAAMC,EAAAC,EAAAA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":["../../../../src/components/OffsetWellMap/OffsetWellMap.js"],"sourcesContent":["import { createElement, useRef, useEffect, useState, useMemo } from 'react';\nimport ReactDOM from 'react-dom';\nimport { get } from 'lodash';\nimport classNames from 'classnames';\nimport { Tooltip } from '@material-ui/core';\nimport { Add as ZoomInIcon, Remove as ZoomOutIcon } from '@material-ui/icons';\nimport 'mapbox-gl/dist/mapbox-gl.css';\n\nimport SubjectWellIcon from './CustomIcon/SubjectWellIcon.svg';\nimport SubjectHighlightWellIcon from './CustomIcon/SubjectHighlightWellIcon.svg';\nimport { usePreviousWells } from './effects';\nimport { WellTooltip } from './WellTooltip';\nimport { getAllFormations } from './utils';\n\nimport styles from './OffsetWellMap.module.css';\n\nimport mapboxgl from '~/config/mapboxGl';\nimport { mapbox } from '~/utils';\n\nconst { isValidCoordinates } = mapbox;\nconst DEFAULT_COORDS = [29.749907, -95.358421];\nconst WELL_MARKER_SIZE = 5;\nconst HIGHLIGHT_MARKER_SIZE = 12;\nconst OFFSET_WELL_COLOR = '#03BCD4';\nconst RADIUS_CIRCLE_COLOR = '#03BCD4';\nconst HIGHLIGHT_WELL_COLOR = '#63EFFF';\nconst METERS_IN_MILE = 1609.34;\nconst ZOOM_INIT_VALUE = 3;\nconst ZOOM_MAX_VALUE = 18;\nconst ZOOM_MIN_VALUE = 1;\nconst MAX_RADIUS = 3000;\n\nconst RADIUS_SOURCE_ID = 'radius-circle';\nconst RADIUS_LAYER_ID = 'radius-circle-fill';\nconst WELLS_SOURCE_ID = 'wells';\nconst WELLS_HALO_LAYER_ID = 'wells-halo';\nconst WELLS_LAYER_ID = 'wells-circle';\nconst WELLS_ACTIVE_LAYER_ID = 'wells-active-highlight';\nconst WELLS_HOVER_LAYER_ID = 'wells-hover-highlight';\nconst EMPTY_FEATURE_COLLECTION = { type: 'FeatureCollection', features: [] };\nconst NO_HOVER_FILTER = ['==', ['id'], -1];\n\n// NOTE: Props keep the Leaflet [lat, lng] convention; mapbox-gl expects [lng, lat]\nconst toLngLat = ([lat, lng]) => [lng, lat];\n\n// NOTE: mapbox-gl circle layers are pixel-radius, so approximate the meter radius with a polygon\nconst makeCirclePolygon = ([lat, lng], radiusMeters, points = 64) => {\n const degreesLng = radiusMeters / (111320 * Math.cos((lat * Math.PI) / 180));\n const degreesLat = radiusMeters / 110574;\n const ring = [];\n for (let i = 0; i <= points; i += 1) {\n const theta = (i / points) * 2 * Math.PI;\n ring.push([lng + degreesLng * Math.cos(theta), lat + degreesLat * Math.sin(theta)]);\n }\n return { type: 'Polygon', coordinates: [ring] };\n};\n\nconst getCircleBounds = ([lat, lng], radiusMeters) => {\n const degreesLng = radiusMeters / (111320 * Math.cos((lat * Math.PI) / 180));\n const degreesLat = radiusMeters / 110574;\n return [\n [lng - degreesLng, lat - degreesLat],\n [lng + degreesLng, lat + degreesLat],\n ];\n};\n\n/** @type {React.FC<import('./OffsetWellMapProps').OffsetWellMapProps>} */\nconst OffsetWellMap = ({\n isViewOnly,\n subjectWell = null,\n wells,\n offsetWellIds,\n radius,\n handleChanageOffsetWell,\n handleChangeOffsetWell = handleChanageOffsetWell,\n activeWellId,\n isClickable = true,\n classes = {},\n}) => {\n const subjectWellCoords = useMemo(() => {\n return subjectWell && get(subjectWell, 'topHole.coordinates');\n }, [subjectWell]);\n const formationColors = useMemo(() => getAllFormations(wells), [wells]);\n\n const containerRef = useRef();\n const mapRef = useRef();\n const popupRef = useRef();\n const radiusBoundsRef = useRef(null);\n const wellsBoundsRef = useRef(null);\n const subjectIconRef = useRef();\n const wellByFeatureIdRef = useRef(new Map());\n const subjectFeatureIdRef = useRef(null);\n const hoveredFeatureIdRef = useRef(null);\n const [isSubjectWellHovered, setIsSubjectWellHovered] = useState(false);\n const isActiveWellIsSubjectWell = subjectWell?.id === activeWellId;\n const prevWells = usePreviousWells(wells);\n const [isMapReady, setIsMapReady] = useState(false);\n const [zoom, setZoom] = useState(ZOOM_INIT_VALUE);\n\n // NOTE: Initialize map\n useEffect(() => {\n const map = new mapboxgl.Map({\n container: containerRef.current,\n style: 'mapbox://styles/mapbox/dark-v9',\n center: toLngLat(DEFAULT_COORDS),\n zoom: ZOOM_INIT_VALUE,\n // NOTE: keep the zoom buttons' disable logic (zoom === ZOOM_MAX_VALUE) reachable\n maxZoom: ZOOM_MAX_VALUE,\n attributionControl: false,\n scrollZoom: false,\n doubleClickZoom: false,\n });\n mapRef.current = map;\n\n // NOTE: GL zoom is fractional where Leaflet was integer\n map.on('zoomend', () => setZoom(Math.round(map.getZoom())));\n\n // NOTE: Sources/layers can only be added after the style loads\n map.on('load', () => {\n map.addSource(RADIUS_SOURCE_ID, { type: 'geojson', data: EMPTY_FEATURE_COLLECTION });\n map.addLayer({\n id: RADIUS_LAYER_ID,\n type: 'fill',\n source: RADIUS_SOURCE_ID,\n paint: {\n 'fill-color': RADIUS_CIRCLE_COLOR,\n 'fill-opacity': 0.2,\n },\n });\n\n map.addSource(WELLS_SOURCE_ID, { type: 'geojson', data: EMPTY_FEATURE_COLLECTION });\n map.addLayer({\n id: WELLS_HALO_LAYER_ID,\n type: 'circle',\n source: WELLS_SOURCE_ID,\n filter: ['==', ['get', 'isOffsetWell'], true],\n paint: {\n 'circle-radius': HIGHLIGHT_MARKER_SIZE,\n 'circle-color': ['get', 'color'],\n 'circle-opacity': 0.08,\n },\n });\n map.addLayer({\n id: WELLS_LAYER_ID,\n type: 'circle',\n source: WELLS_SOURCE_ID,\n layout: {\n 'circle-sort-key': ['get', 'order'],\n },\n paint: {\n 'circle-radius': WELL_MARKER_SIZE,\n 'circle-color': ['get', 'color'],\n 'circle-opacity': ['get', 'opacity'],\n },\n });\n map.addLayer({\n id: WELLS_ACTIVE_LAYER_ID,\n type: 'circle',\n source: WELLS_SOURCE_ID,\n filter: ['==', ['get', 'isActive'], true],\n paint: {\n 'circle-radius': HIGHLIGHT_MARKER_SIZE,\n 'circle-color': ['get', 'color'],\n 'circle-opacity': 0.24,\n },\n });\n map.addLayer({\n id: WELLS_HOVER_LAYER_ID,\n type: 'circle',\n source: WELLS_SOURCE_ID,\n filter: NO_HOVER_FILTER,\n paint: {\n 'circle-radius': [\n 'case',\n ['get', 'isSubjectWell'],\n WELL_MARKER_SIZE,\n HIGHLIGHT_MARKER_SIZE,\n ],\n 'circle-color': [\n 'case',\n ['get', 'isSubjectWell'],\n HIGHLIGHT_WELL_COLOR,\n ['get', 'color'],\n ],\n 'circle-opacity': 0.24,\n },\n });\n\n setIsMapReady(true);\n });\n\n return () => {\n map.remove();\n mapRef.current = null;\n popupRef.current = null;\n subjectIconRef.current = null;\n radiusBoundsRef.current = null;\n wellsBoundsRef.current = null;\n };\n }, []);\n\n // NOTE: Radius circle\n useEffect(() => {\n radiusBoundsRef.current =\n subjectWellCoords && radius\n ? getCircleBounds(subjectWellCoords, radius * METERS_IN_MILE)\n : null;\n\n const map = mapRef.current;\n if (!map || !isMapReady) {\n return;\n }\n\n map.getSource(RADIUS_SOURCE_ID).setData(\n subjectWellCoords && radius\n ? {\n type: 'Feature',\n properties: {},\n geometry: makeCirclePolygon(subjectWellCoords, radius * METERS_IN_MILE),\n }\n : EMPTY_FEATURE_COLLECTION\n );\n }, [radius, subjectWellCoords, isMapReady]);\n\n const showTooltip = (well, isOffsetWell, isSubjectWell, coords) => {\n const popUpContainer = document.createElement('div');\n const popUpContent = createElement(WellTooltip(), {\n isViewOnly,\n well,\n color: get(formationColors, well.formation, '#BDBDBD'),\n isOffsetWell,\n isSubjectWell,\n isClickable,\n });\n ReactDOM.render(<>{popUpContent}</>, popUpContainer);\n if (!popupRef.current) {\n popupRef.current = new mapboxgl.Popup({\n closeButton: false,\n offset: HIGHLIGHT_MARKER_SIZE,\n });\n }\n popupRef.current\n .setLngLat(toLngLat(coords))\n .setDOMContent(popUpContainer)\n .addTo(mapRef.current);\n };\n\n // NOTE: Subject well hover swaps the subject marker color\n useEffect(() => {\n const map = mapRef.current;\n if (!map || !isMapReady) {\n return;\n }\n\n map.setPaintProperty(\n WELLS_LAYER_ID,\n 'circle-color',\n isSubjectWellHovered\n ? ['case', ['get', 'isSubjectWell'], HIGHLIGHT_WELL_COLOR, ['get', 'color']]\n : ['get', 'color']\n );\n }, [isSubjectWellHovered, isMapReady]);\n\n // NOTE: Well markers\n useEffect(() => {\n if (!wells || !offsetWellIds) {\n return undefined;\n }\n\n popupRef.current?.remove();\n\n const offsetWells = [];\n const unSelectedWells = [];\n wells.forEach(well => {\n if (well.id !== subjectWell?.id) {\n if (offsetWellIds.includes(well.id)) {\n offsetWells.push(well);\n } else {\n unSelectedWells.push(well);\n }\n }\n });\n const sortedWells = [...unSelectedWells, ...offsetWells, subjectWell];\n\n const features = [];\n const wellsBounds = new mapboxgl.LngLatBounds();\n wellByFeatureIdRef.current.clear();\n subjectFeatureIdRef.current = null;\n sortedWells.forEach((well, index) => {\n const coords = well?.topHole?.coordinates;\n\n if (coords && isValidCoordinates(coords)) {\n const isSubjectWell = subjectWell?.id === well.id;\n const isOffsetWell = offsetWellIds.includes(well.id) && !isSubjectWell;\n const color = isSubjectWell\n ? OFFSET_WELL_COLOR\n : get(formationColors, well.formation, '#BDBDBD');\n const opacity = isOffsetWell ? 0.7 : 0.3;\n\n features.push({\n type: 'Feature',\n id: index,\n geometry: { type: 'Point', coordinates: toLngLat(coords) },\n properties: {\n color,\n opacity: isSubjectWell ? 1 : opacity,\n isSubjectWell,\n isOffsetWell,\n isActive: well.id === activeWellId && !isActiveWellIsSubjectWell,\n order: index,\n },\n });\n wellByFeatureIdRef.current.set(index, { well, coords, isOffsetWell, isSubjectWell });\n if (isSubjectWell) {\n subjectFeatureIdRef.current = index;\n }\n wellsBounds.extend(toLngLat(coords));\n }\n });\n wellsBoundsRef.current = features.length ? wellsBounds : null;\n\n const map = mapRef.current;\n if (!map || !isMapReady) {\n return undefined;\n }\n\n map.getSource(WELLS_SOURCE_ID).setData({ type: 'FeatureCollection', features });\n map.setFilter(WELLS_HOVER_LAYER_ID, NO_HOVER_FILTER);\n hoveredFeatureIdRef.current = null;\n\n const handleMouseMove = e => {\n const feature = e.features?.[0];\n if (!feature || hoveredFeatureIdRef.current === feature.id) {\n return;\n }\n const entry = wellByFeatureIdRef.current.get(feature.id);\n if (!entry) {\n return;\n }\n\n hoveredFeatureIdRef.current = feature.id;\n map.getCanvas().style.cursor = 'pointer';\n\n // Highlight\n map.setFilter(WELLS_HOVER_LAYER_ID, ['==', ['id'], feature.id]);\n showTooltip(entry.well, entry.isOffsetWell, entry.isSubjectWell, entry.coords);\n if (entry.isSubjectWell) {\n setIsSubjectWellHovered(true);\n }\n };\n\n const handleMouseLeave = e => {\n // NOTE: Leaflet cleared hover on leaving the ENLARGED highlight marker, so keep the\n // hover while the cursor is still over the hover halo (or another well marker)\n if (\n e?.point &&\n map.queryRenderedFeatures(e.point, { layers: [WELLS_LAYER_ID, WELLS_HOVER_LAYER_ID] })\n .length\n ) {\n return;\n }\n const wasSubjectWell =\n hoveredFeatureIdRef.current !== null &&\n hoveredFeatureIdRef.current === subjectFeatureIdRef.current;\n hoveredFeatureIdRef.current = null;\n map.getCanvas().style.cursor = '';\n map.setFilter(WELLS_HOVER_LAYER_ID, NO_HOVER_FILTER);\n popupRef.current?.remove();\n if (wasSubjectWell) {\n setIsSubjectWellHovered(false);\n }\n };\n\n const handleClick = e => {\n if (isViewOnly) return;\n const entry = wellByFeatureIdRef.current.get(e.features?.[0]?.id);\n if (!entry) {\n return;\n }\n handleChangeOffsetWell(entry.well, !entry.isOffsetWell);\n };\n\n map.on('mousemove', WELLS_LAYER_ID, handleMouseMove);\n map.on('mouseleave', WELLS_LAYER_ID, handleMouseLeave);\n map.on('mouseleave', WELLS_HOVER_LAYER_ID, handleMouseLeave);\n map.on('click', WELLS_LAYER_ID, handleClick);\n\n setTimeout(() => {\n if (radius < MAX_RADIUS && mapRef.current && radiusBoundsRef.current && wells !== prevWells) {\n mapRef.current.fitBounds(radiusBoundsRef.current, { padding: 5 });\n }\n }, 500);\n\n return () => {\n map.off('mousemove', WELLS_LAYER_ID, handleMouseMove);\n map.off('mouseleave', WELLS_LAYER_ID, handleMouseLeave);\n map.off('mouseleave', WELLS_HOVER_LAYER_ID, handleMouseLeave);\n map.off('click', WELLS_LAYER_ID, handleClick);\n };\n }, [subjectWell, wells, offsetWellIds, activeWellId, isMapReady]);\n\n // NOTE: Subject Well Icon\n\n useEffect(() => {\n const map = mapRef.current;\n\n if (subjectIconRef.current) {\n subjectIconRef.current.remove();\n subjectIconRef.current = null;\n }\n\n if (!map || !subjectWellCoords) return;\n\n const isHighlighted = isSubjectWellHovered || isActiveWellIsSubjectWell;\n const icon = document.createElement('img');\n icon.src = isHighlighted ? SubjectHighlightWellIcon : SubjectWellIcon;\n const [iconWidth, iconHeight] = isHighlighted ? [70, 20] : [62, 12];\n const [anchorX, anchorY] = isHighlighted ? [35, 29] : [31, 25];\n icon.width = iconWidth;\n icon.height = iconHeight;\n\n icon.addEventListener('mouseover', () => {\n setIsSubjectWellHovered(true);\n\n // Highlight\n if (subjectFeatureIdRef.current !== null && map.getLayer(WELLS_HOVER_LAYER_ID)) {\n hoveredFeatureIdRef.current = subjectFeatureIdRef.current;\n map.setFilter(WELLS_HOVER_LAYER_ID, ['==', ['id'], subjectFeatureIdRef.current]);\n }\n showTooltip(subjectWell, false, true, subjectWellCoords);\n });\n\n icon.addEventListener('mouseout', () => {\n hoveredFeatureIdRef.current = null;\n if (map.getLayer(WELLS_HOVER_LAYER_ID)) {\n map.setFilter(WELLS_HOVER_LAYER_ID, NO_HOVER_FILTER);\n }\n popupRef.current?.remove();\n setIsSubjectWellHovered(false);\n });\n\n subjectIconRef.current = new mapboxgl.Marker({\n element: icon,\n anchor: 'center',\n // NOTE: Leaflet anchored the icon at [anchorX, anchorY] from its top-left corner\n offset: [iconWidth / 2 - anchorX, iconHeight / 2 - anchorY],\n })\n .setLngLat(toLngLat(subjectWellCoords))\n .addTo(map);\n }, [isSubjectWellHovered, subjectWellCoords, radius, subjectWell, isActiveWellIsSubjectWell]);\n\n // NOTE: Map Update\n useEffect(() => {\n if (radius > MAX_RADIUS) {\n mapRef.current.setZoom(1);\n return;\n }\n setTimeout(() => {\n if (subjectWell) {\n if (mapRef.current && radiusBoundsRef.current && radius) {\n mapRef.current.fitBounds(radiusBoundsRef.current, { padding: 5 });\n }\n } else if (mapRef.current && wellsBoundsRef.current) {\n mapRef.current.fitBounds(wellsBoundsRef.current);\n }\n if (subjectWellCoords && mapRef.current) {\n mapRef.current.easeTo({ center: toLngLat(subjectWellCoords), duration: 700 });\n }\n }, 500);\n }, [radius, subjectWell, subjectWellCoords]);\n\n const handleZoomIn = () => {\n mapRef.current.setZoom(zoom + 1);\n };\n\n const handleZoomOut = () => {\n if (zoom > 1) {\n mapRef.current.setZoom(zoom - 1);\n }\n };\n\n return (\n <div className={classNames(styles.mapView, classes.root)}>\n <div\n className={classNames(styles.mapMain, classes.map)}\n ref={containerRef}\n onDoubleClick={handleZoomIn}\n >\n <div className={styles.zoomGroup}>\n <Tooltip title={zoom < ZOOM_MAX_VALUE ? 'Zoom in' : ''} placement=\"left\">\n <div\n className={classNames(styles.zoomButton, {\n [styles.zoomDisabled]: zoom === ZOOM_MAX_VALUE,\n })}\n onClick={handleZoomIn}\n >\n <ZoomInIcon className={styles.zoomInOutIcon} />\n </div>\n </Tooltip>\n <Tooltip title={zoom > ZOOM_MIN_VALUE ? 'Zoom out' : ''} placement=\"left\">\n <div\n className={classNames(styles.zoomButton, {\n [styles.zoomDisabled]: zoom === ZOOM_MIN_VALUE,\n })}\n onClick={handleZoomOut}\n >\n <ZoomOutIcon className={styles.zoomInOutIcon} />\n </div>\n </Tooltip>\n </div>\n </div>\n </div>\n );\n};\n\nexport default OffsetWellMap;\n"],"names":["isValidCoordinates","mapbox","DEFAULT_COORDS","EMPTY_FEATURE_COLLECTION","type","features","NO_HOVER_FILTER","toLngLat","_ref","_ref2","_slicedToArray","lat","makeCirclePolygon","_ref3","radiusMeters","_ref4","lng","points","degreesLng","Math","cos","PI","degreesLat","ring","i","theta","push","sin","coordinates","_ref7","isViewOnly","_ref7$subjectWell","subjectWell","wells","offsetWellIds","radius","handleChanageOffsetWell","_ref7$handleChangeOff","handleChangeOffsetWell","activeWellId","_ref7$isClickable","isClickable","_ref7$classes","classes","subjectWellCoords","useMemo","get","formationColors","getAllFormations","containerRef","useRef","mapRef","popupRef","radiusBoundsRef","wellsBoundsRef","subjectIconRef","wellByFeatureIdRef","Map","subjectFeatureIdRef","hoveredFeatureIdRef","useState","_useState2","_useState","isSubjectWellHovered","setIsSubjectWellHovered","isActiveWellIsSubjectWell","id","prevWells","usePreviousWells","_useState4","_useState3","isMapReady","setIsMapReady","_useState6","_useState5","zoom","setZoom","useEffect","map","mapboxgl","container","current","style","center","maxZoom","attributionControl","scrollZoom","doubleClickZoom","on","round","getZoom","addSource","data","addLayer","source","paint","filter","layout","remove","_ref5","_ref6","getSource","setData","properties","geometry","showTooltip","well","isOffsetWell","isSubjectWell","coords","popUpContainer","document","createElement","popUpContent","WellTooltip","color","formation","ReactDOM","render","_jsx","jsx","_Fragment","children","Popup","closeButton","offset","setLngLat","setDOMContent","addTo","setPaintProperty","_popupRef$current","offsetWells","unSelectedWells","forEach","includes","sortedWells","wellsBounds","LngLatBounds","clear","index","_well$topHole","topHole","opacity","isActive","order","set","extend","length","setFilter","handleMouseMove","e","_e$features","feature","entry","getCanvas","cursor","handleMouseLeave","_popupRef$current2","point","queryRenderedFeatures","layers","wasSubjectWell","handleClick","_e$features2","_e$features2$","setTimeout","fitBounds","padding","off","isHighlighted","icon","src","_ref8","_ref9","iconWidth","iconHeight","_ref10","_ref11","anchorX","anchorY","width","height","addEventListener","getLayer","_popupRef$current3","Marker","element","anchor","easeTo","duration","handleZoomIn","className","classNames","styles","mapView","root","mapMain","ref","onDoubleClick","_jsxs","jsxs","zoomGroup","Tooltip","title","placement","zoomButton","_defineProperty","zoomDisabled","onClick","ZoomInIcon","zoomInOutIcon","ZoomOutIcon"],"mappings":"wrBAmBQA,EAAuBC,EAAMA,OAA7BD,mBACFE,EAAiB,CAAC,WAAY,WAmB9BC,EAA2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AKT,UAAWE,EAAOQ,UAAU/E,SAAA,CAC/BH,MAACmF,UAAO,CAACC,MAAOhI,GA7cH,GA6c2B,UAAY,GAAIiI,UAAU,OAAMlF,SACtEH,EAAAC,IAAA,MAAA,CACEuE,UAAWC,EAAU,QAACC,EAAOY,WAAUC,EAAA,QAAA,GACpCb,EAAOc,aAhdD,KAgdgBpI,KAEzBqI,QAASlB,GAAapE,SAEtBH,MAAC0F,MAAU,CAAClB,UAAWE,EAAOiB,oBAGlC3F,MAACmF,UAAO,CAACC,MAAOhI,GAtdH,EAsd2B,WAAa,GAAIiI,UAAU,OAAMlF,SACvEH,EAAAC,IAAA,MAAA,CACEuE,UAAWC,EAAU,QAACC,EAAOY,WAAUC,EAAA,QAAA,GACpCb,EAAOc,aAzdD,IAydgBpI,KAEzBqI,QA7BU,WAChBrI,GAAO,GACTxB,EAAO8B,QAAQL,QAAQD,GAAO,IA2BC+C,SAEvBH,MAAC4F,SAAW,CAACpB,UAAWE,EAAOiB,0BAO7C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')(".OffsetWellMap-module_mapView__EwhHO{width:100%}.OffsetWellMap-module_zoomGroup__qCVgz{bottom:12px;display:flex;flex-direction:column;gap:4px;position:absolute;right:12px;z-index:9}.OffsetWellMap-module_zoomButton__oZIkU{align-items:center;background:var(--palette-background-b-6);border-radius:4px;color:var(--palette-primary-text-6);cursor:pointer;display:flex;font-size:22px;height:32px;justify-content:center;text-align:center;user-select:none;width:32px}.OffsetWellMap-module_zoomButton__oZIkU:hover{background:var(--palette-background-b-7);color:#fff}.OffsetWellMap-module_zoomDisabled__60g-G{cursor:not-allowed}.OffsetWellMap-module_zoomDisabled__60g-G:hover{background:var(--palette-background-b-6);color:var(--palette-primary-text-6)}.OffsetWellMap-module_zoomInOutIcon__tUzKY{font-size:1rem!important}.OffsetWellMap-module_mapMain__IYEA1{background-color:var(--palette-background-b-9);border:1px solid var(--palette-background-b-9);border-radius:4px;flex:100;height:200px;position:relative;width:100%}.OffsetWellMap-module_mapView__EwhHO .
|
|
1
|
+
"use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')(".OffsetWellMap-module_mapView__EwhHO{width:100%}.OffsetWellMap-module_zoomGroup__qCVgz{bottom:12px;display:flex;flex-direction:column;gap:4px;position:absolute;right:12px;z-index:9}.OffsetWellMap-module_zoomButton__oZIkU{align-items:center;background:var(--palette-background-b-6);border-radius:4px;color:var(--palette-primary-text-6);cursor:pointer;display:flex;font-size:22px;height:32px;justify-content:center;text-align:center;user-select:none;width:32px}.OffsetWellMap-module_zoomButton__oZIkU:hover{background:var(--palette-background-b-7);color:#fff}.OffsetWellMap-module_zoomDisabled__60g-G{cursor:not-allowed}.OffsetWellMap-module_zoomDisabled__60g-G:hover{background:var(--palette-background-b-6);color:var(--palette-primary-text-6)}.OffsetWellMap-module_zoomInOutIcon__tUzKY{font-size:1rem!important}.OffsetWellMap-module_mapMain__IYEA1{background-color:var(--palette-background-b-9);border:1px solid var(--palette-background-b-9);border-radius:4px;flex:100;height:200px;position:relative;width:100%}.OffsetWellMap-module_mapView__EwhHO .mapboxgl-popup-content{background-color:transparent;box-shadow:none;opacity:.9;padding:0}.OffsetWellMap-module_mapView__EwhHO .mapboxgl-popup-tip{display:none}"),module.exports={mapView:"OffsetWellMap-module_mapView__EwhHO",zoomGroup:"OffsetWellMap-module_zoomGroup__qCVgz",zoomButton:"OffsetWellMap-module_zoomButton__oZIkU",zoomDisabled:"OffsetWellMap-module_zoomDisabled__60g-G",zoomInOutIcon:"OffsetWellMap-module_zoomInOutIcon__tUzKY",mapMain:"OffsetWellMap-module_mapMain__IYEA1"};
|
|
2
2
|
//# sourceMappingURL=OffsetWellMap.module.css.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')(".WellTooltip-module_wellTooltip__-U3-H{background-color:var(--palette-background-b-8);border-radius:4px;color:var(--palette-primary-text-1);display:flex;flex-direction:column;font-family:Roboto;font-style:normal;gap:4px;min-width:180px;padding:8px;
|
|
1
|
+
"use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')(".WellTooltip-module_wellTooltip__-U3-H{background-color:var(--palette-background-b-8);border-radius:4px;color:var(--palette-primary-text-1);display:flex;flex-direction:column;font-family:Roboto;font-style:normal;gap:4px;min-width:180px;padding:8px;width:fit-content}.WellTooltip-module_commonItem__NxlCt{max-width:300px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.WellTooltip-module_wellName__vrUth{font-size:12px;font-weight:400;line-height:16px;padding-bottom:4px}.WellTooltip-module_tooltipItem__FFmW9{font-size:14px;font-weight:400;line-height:20px}.WellTooltip-module_unit__qbuWG{color:var(--palette-primary-text-6);font-size:12px;font-weight:400;line-height:14px}.WellTooltip-module_formationItem__JK-Vs{align-items:center;display:flex;flex-direction:row;font-size:14px;font-weight:400;line-height:20px}.WellTooltip-module_formation__9geyr{border-radius:50%;height:8px;margin-left:8px;margin-right:4px;width:8px}.WellTooltip-module_info__hvxAd{align-items:center;display:flex;flex-direction:row;gap:4px;padding-top:8px}.WellTooltip-module_infoIcon__tsnME{color:#64b5f6!important;font-size:16px!important;position:relative!important}.WellTooltip-module_blockIcon__t7NSY{color:#dadada!important;font-size:16px!important;position:relative!important}.WellTooltip-module_infoLabel__4FPIc{color:var(--palette-primary-text-6);font-size:12px;font-weight:400;line-height:16px}"),module.exports={wellTooltip:"WellTooltip-module_wellTooltip__-U3-H",commonItem:"WellTooltip-module_commonItem__NxlCt",wellName:"WellTooltip-module_wellName__vrUth",tooltipItem:"WellTooltip-module_tooltipItem__FFmW9",unit:"WellTooltip-module_unit__qbuWG",formationItem:"WellTooltip-module_formationItem__JK-Vs",formation:"WellTooltip-module_formation__9geyr",info:"WellTooltip-module_info__hvxAd",infoIcon:"WellTooltip-module_infoIcon__tsnME",blockIcon:"WellTooltip-module_blockIcon__t7NSY",infoLabel:"WellTooltip-module_infoLabel__4FPIc"};
|
|
2
2
|
//# sourceMappingURL=WellTooltip.module.css.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require('./../../../../ext-esm/style-inject/dist/style-inject.es.js')(".Map_map__cq-fM{width:100%}.Map_mapMain__llG4C{background-color:#414141;border-radius:4px;flex:100;height:250px;width:100%}.Map_mapFooter__0m62e{display:flex;flex:1;flex-wrap:wrap;padding-bottom:5px;padding-top:5px}.Map_mapFooterItem__wJdaF{align-items:center;display:flex;margin-right:10px;white-space:nowrap}.Map_mapFooterItemSquare__UjAeE{border-radius:50%;height:8px;margin-right:5px;width:8px}.Map_mapFooterItemLabel__jKEkY{color:#ccc;font-size:11px}.Map_map__cq-fM .
|
|
1
|
+
"use strict";require('./../../../../ext-esm/style-inject/dist/style-inject.es.js')(".Map_map__cq-fM{width:100%}.Map_mapMain__llG4C{background-color:#414141;border-radius:4px;flex:100;height:250px;width:100%}.Map_mapFooter__0m62e{display:flex;flex:1;flex-wrap:wrap;padding-bottom:5px;padding-top:5px}.Map_mapFooterItem__wJdaF{align-items:center;display:flex;margin-right:10px;white-space:nowrap}.Map_mapFooterItemSquare__UjAeE{border-radius:50%;height:8px;margin-right:5px;width:8px}.Map_mapFooterItemLabel__jKEkY{color:#ccc;font-size:11px}.Map_map__cq-fM .mapboxgl-popup-content{background-color:#414141;border-radius:4px;box-shadow:0 5px 5px rgba(0,0,0,.2),0 3px 14px rgba(0,0,0,.12),0 8px 10px rgba(0,0,0,.14);padding:10px 16px;width:420px!important}.Map_map__cq-fM .mapboxgl-popup-tip{display:none}.Map_map__cq-fM .mapboxgl-ctrl-group{background:none;border:none;box-shadow:none}.Map_map__cq-fM .mapboxgl-ctrl-group button{background:#272727;border:none;border-radius:4px;height:32px;margin-top:4px;width:32px}.Map_map__cq-fM .mapboxgl-ctrl-group button .mapboxgl-ctrl-icon{filter:invert(.8)}.Map_map__cq-fM .mapboxgl-ctrl-group button:hover{background:#303030}.Map_map__cq-fM .mapboxgl-ctrl-group button:hover .mapboxgl-ctrl-icon{filter:invert(1)}"),module.exports={map:"Map_map__cq-fM",mapMain:"Map_mapMain__llG4C",mapFooter:"Map_mapFooter__0m62e",mapFooterItem:"Map_mapFooterItem__wJdaF",mapFooterItemSquare:"Map_mapFooterItemSquare__UjAeE",mapFooterItemLabel:"Map_mapFooterItemLabel__jKEkY"};
|
|
2
2
|
//# sourceMappingURL=Map.css.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),u=require("react-dom"),i=require("prop-types"),
|
|
1
|
+
"use strict";var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),u=require("react-dom"),i=require("prop-types"),a=require("lodash"),o=require("@material-ui/core/styles"),n=require("./Map.css.js"),s=require("../../../../utils/index.js"),l=require("../../../../config/theme/index.js");require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/helpers/typeof"),require("@babel/runtime/regenerator"),require("highcharts-v8"),require("highcharts-v8/highcharts-more"),require("highcharts-v8/modules/solid-gauge"),require("highcharts-v8/modules/heatmap"),require("highcharts-v8/modules/boost"),require("highcharts-v8/modules/exporting"),require("highcharts-v8/modules/xrange"),require("highcharts-v8/modules/dumbbell"),require("highcharts-v8/modules/pattern-fill"),require("highcharts-v8/modules/annotations"),require("highcharts-multicolor-series-v8"),require("highcharts"),require("highcharts/highcharts-more"),require("highcharts/modules/solid-gauge"),require("highcharts/modules/heatmap"),require("highcharts/modules/boost"),require("highcharts/modules/exporting"),require("highcharts/modules/xrange"),require("highcharts/modules/dumbbell"),require("highcharts/modules/pattern-fill"),require("highcharts/modules/annotations"),require("highcharts-multicolor-series"),require("dompurify"),require("@babel/runtime/helpers/createClass"),require("@babel/runtime/helpers/classCallCheck"),require("@babel/runtime/helpers/assertThisInitialized"),require("@babel/runtime/helpers/inherits"),require("@babel/runtime/helpers/possibleConstructorReturn"),require("@babel/runtime/helpers/getPrototypeOf"),require("@babel/runtime/helpers/toArray"),require("@babel/runtime/helpers/toConsumableArray"),require("../../../../clients/subscriptions/constants.js"),require("../../../../clients/subscriptions.v1.js"),require("../../../../clients/subscriptions/subscriptions-client.factory.js"),require("../../../../config/extendNative.js"),require("../../../../config/mapboxGl/index.js"),require("mapbox-gl/dist/mapbox-gl.css");var c=require("react/jsx-runtime"),d=require("mapbox-gl");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=f(e),m=f(r),p=f(u),g=f(i),b=f(d);function v(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);r&&(u=u.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,u)}return t}function q(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?v(Object(t),!0).forEach((function(r){h.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):v(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var y=s.mapbox.isValidCoordinates,F=["#FF00FF","#F5BD80","#FF0000","#0080FF","#FF8000","#58ACFA","#FA58F4","#40FF00","#4B8A08","#40FF00","#D8F781"],j=[29.749907,-95.358421],x={type:"FeatureCollection",features:[]},w=function(e){var r=m.default(e,2),t=r[0];return[r[1],t]};function O(e){var r=e.subjectWell,u=e.wells,i=e.offsetWells,s=e.radius,d=e.subjectWellMarkerSize,f=e.wellMarkerSize,g=e.popUpFormatter,v=e.coordsDataPath,O=t.useRef(null),P=t.useRef(null),C=t.useRef(null),M=t.useRef(null),S=t.useRef(null),D=t.useRef(),N=t.useState(!1),k=m.default(N,2),B=k[0],I=k[1],W=t.useMemo((function(){return u.filter((function(e){return!r||r.id!==e.id}))}),[r,u]),E=t.useMemo((function(){return r&&a.get(r,v)}),[r,v]),L=t.useMemo((function(){var e=[],t=!1;W.forEach((function(u){"Null"===u.formation?t=!0:r&&r.formation===u.formation||e.includes(u.formation)||e.push(u.formation)}));var u=r?[r.formation].concat(a.sortBy(e)):a.sortBy(e);t&&!u.includes("Null")&&u.push("Null");var i=u.reduce((function(e,r,t){return q(q({},e),{},h.default({},r,F[t%F.length]))}),{});return[u,i]}),[r,W]),R=m.default(L,2),T=R[0],z=R[1];return t.useEffect((function(){P.current=new b.default.Map({container:O.current,style:"mapbox://styles/mapbox/dark-v9",center:w(j),zoom:1,attributionControl:!1,scrollZoom:!1}),P.current.addControl(new b.default.NavigationControl({showCompass:!1}),"bottom-right"),P.current.on("load",(function(){P.current.addSource("radius-circle",{type:"geojson",data:x}),P.current.addLayer({id:"radius-circle",type:"fill",source:"radius-circle",paint:{"fill-color":"#03BCD4","fill-opacity":.2}}),P.current.addSource("wells",{type:"geojson",data:x}),P.current.addLayer({id:"wells",type:"circle",source:"wells",paint:{"circle-radius":["get","radius"],"circle-color":["get","color"],"circle-opacity":["get","opacity"]}}),I(!0)}));var e=P.current;return function(){e.remove(),P.current=null,C.current=null,M.current=null}}),[]),t.useEffect((function(){if(P.current&&B){if(!E)return P.current.getSource("radius-circle").setData(x),void(C.current=null);var e=function(e,r){for(var t=m.default(e,2),u=t[0],i=t[1],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:64,o=[],n=r/(111320*Math.cos(u*Math.PI/180)),s=r/110574,l=0;l<=a;l+=1){var c=l/a*(2*Math.PI);o.push([i+n*Math.cos(c),u+s*Math.sin(c)])}return o}(E,1609.34*s);P.current.getSource("radius-circle").setData({type:"Feature",geometry:{type:"Polygon",coordinates:[e]}}),C.current=e.reduce((function(e,r){return e.extend(r)}),new b.default.LngLatBounds)}}),[s,E,B]),t.useEffect((function(){var e;if(P.current&&B){var n=D.current;D.current=u,null===(e=S.current)||void 0===e||e.remove();var s=i.map((function(e){return e.id})),h=[],m={},q=new b.default.LngLatBounds;u.forEach((function(e){var t=a.get(e,v);if(t&&y(t)){var u=r&&r.id===e.id,i=s.includes(e.id),o=u?d:f,n=u||i?"#00FFFF":z[e.formation],l=u||i?1:.3;m[e.id]=e,q.extend(w(t)),h.push({type:"Feature",geometry:{type:"Point",coordinates:w(t)},properties:{wellId:e.id,radius:o,color:n,opacity:l}})}})),P.current.getSource("wells").setData({type:"FeatureCollection",features:h}),M.current=h.length?q:null;var F=P.current,j=null,x=function(e){F.getCanvas().style.cursor="pointer";var r=m[e.features[0].properties.wellId];if(r&&r.id!==j&&(j=r.id,g)){var u=document.createElement("div"),i=t.createElement(g,{well:r,color:z[r.formation]});p.default.render(c.jsx(o.MuiThemeProvider,{theme:l.darkTheme,children:i}),u),S.current||(S.current=new b.default.Popup({closeButton:!1,maxWidth:"none"})),S.current.setLngLat(w(a.get(r,v))).setDOMContent(u).addTo(F)}},O=function(){j=null,F.getCanvas().style.cursor=""};return F.on("mousemove","wells",x),F.on("mouseleave","wells",O),setTimeout((function(){P.current&&C.current&&u!==n&&P.current.fitBounds(C.current,{padding:5})}),500),function(){F.off("mousemove","wells",x),F.off("mouseleave","wells",O)}}}),[r,u,i,z,B]),t.useEffect((function(){setTimeout((function(){r?P.current&&C.current&&P.current.fitBounds(C.current,{padding:5}):P.current&&M.current&&P.current.fitBounds(M.current)}),500)}),[s,r,B]),c.jsxs("div",{className:n.map,children:[c.jsx("div",{className:n.mapMain,ref:O}),c.jsxs("div",{className:n.mapFooter,children:[i&&c.jsxs("div",{className:n.mapFooterItem,children:[c.jsx("div",{className:n.mapFooterItemSquare,style:{backgroundColor:"#00FFFF"}}),c.jsx("div",{className:n.mapFooterItemLabel,children:"Selected Offset Wells"})]}),T.map((function(e){return c.jsxs("div",{className:n.mapFooterItem,children:[c.jsx("div",{className:n.mapFooterItemSquare,style:{backgroundColor:z[e]}}),c.jsx("div",{className:n.mapFooterItemLabel,children:e})]},e)}))]})]})}O.propTypes={subjectWell:g.default.shape({id:g.default.number,formation:g.default.string}),wells:g.default.arrayOf(g.default.shape({})).isRequired,offsetWells:g.default.arrayOf(g.default.shape({})),radius:g.default.number.isRequired,subjectWellMarkerSize:g.default.number,wellMarkerSize:g.default.number,popUpFormatter:g.default.func,coordsDataPath:g.default.string},O.defaultProps={subjectWell:null,subjectWellMarkerSize:10,wellMarkerSize:5,popUpFormatter:null,coordsDataPath:"settings.top_hole.coordinates",offsetWells:null};var P=t.memo(O);module.exports=P;
|
|
2
2
|
//# sourceMappingURL=Map.js.map
|