polygons
This commit is contained in:
@@ -353,6 +353,7 @@ const PropertyDetail = () => {
|
|||||||
const [gpsDistance, setGpsDistance] = useState(0);
|
const [gpsDistance, setGpsDistance] = useState(0);
|
||||||
const [gpsAccuracy, setGpsAccuracy] = useState(null);
|
const [gpsAccuracy, setGpsAccuracy] = useState(null);
|
||||||
const [isSnapPreview, setIsSnapPreview] = useState(false);
|
const [isSnapPreview, setIsSnapPreview] = useState(false);
|
||||||
|
const [showAddMenu, setShowAddMenu] = useState(false);
|
||||||
const [currentColor, setCurrentColor] = useState(SECTION_COLORS[0]);
|
const [currentColor, setCurrentColor] = useState(SECTION_COLORS[0]);
|
||||||
const [showNameModal, setShowNameModal] = useState(false);
|
const [showNameModal, setShowNameModal] = useState(false);
|
||||||
const [pendingSection, setPendingSection] = useState(null);
|
const [pendingSection, setPendingSection] = useState(null);
|
||||||
@@ -810,40 +811,52 @@ const PropertyDetail = () => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex gap-2">
|
<div className="relative">
|
||||||
<button
|
<button
|
||||||
onClick={() => setIsDrawing(!isDrawing)}
|
onClick={() => setShowAddMenu(v=>!v)}
|
||||||
className={`btn-primary flex items-center gap-2 ${isDrawing ? 'bg-red-600 hover:bg-red-700' : ''}`}
|
className="btn-primary flex items-center gap-2"
|
||||||
|
title="Add a lawn section"
|
||||||
>
|
>
|
||||||
<PlusIcon className="h-5 w-5" />
|
<PlusIcon className="h-5 w-5" />
|
||||||
{isDrawing ? 'Cancel Drawing' : 'Tap-to-Draw'}
|
Add Lawn Section
|
||||||
</button>
|
</button>
|
||||||
<button
|
{showAddMenu && (
|
||||||
onClick={() => {
|
<div className="absolute right-0 mt-2 w-56 bg-white border rounded shadow-lg z-10">
|
||||||
// Toggle GPS points mode; ensure trace mode off
|
<button
|
||||||
setIsGPSTraceMode(false);
|
className="w-full text-left px-3 py-2 hover:bg-gray-50"
|
||||||
setIsTracing(false);
|
onClick={() => { setShowAddMenu(false); setIsDrawing(true); setIsGPSPointsMode(false); setIsGPSTraceMode(false); }}
|
||||||
if (gpsWatchId) { navigator.geolocation.clearWatch(gpsWatchId); setGpsWatchId(null); }
|
>
|
||||||
setIsGPSPointsMode(v=>!v);
|
Tap to Draw (manual)
|
||||||
if (!isGPSPointsMode) clearGpsPoints();
|
</button>
|
||||||
}}
|
<button
|
||||||
className={`btn-secondary flex items-center gap-2 ${isGPSPointsMode ? 'ring-2 ring-blue-300' : ''}`}
|
className="w-full text-left px-3 py-2 hover:bg-gray-50"
|
||||||
>
|
onClick={() => {
|
||||||
{isGPSPointsMode ? 'Exit GPS Points' : 'GPS Points'}
|
setShowAddMenu(false);
|
||||||
</button>
|
// Enable GPS points mode, disable trace
|
||||||
<button
|
setIsGPSTraceMode(false);
|
||||||
onClick={() => {
|
setIsTracing(false);
|
||||||
// Toggle trace mode; ensure points mode off
|
if (gpsWatchId) { navigator.geolocation.clearWatch(gpsWatchId); setGpsWatchId(null); }
|
||||||
setIsGPSPointsMode(false);
|
clearGpsPoints();
|
||||||
if (!isGPSTraceMode) clearGpsPoints();
|
setIsGPSPointsMode(true);
|
||||||
if (isGPSTraceMode && gpsWatchId) { navigator.geolocation.clearWatch(gpsWatchId); setGpsWatchId(null); setIsTracing(false); }
|
}}
|
||||||
setIsGPSTraceMode(v=>!v);
|
>
|
||||||
}}
|
GPS Points (walk and mark)
|
||||||
className={`btn-secondary flex items-center gap-2 ${isGPSTraceMode ? 'ring-2 ring-blue-300' : ''}`}
|
</button>
|
||||||
>
|
<button
|
||||||
{isGPSTraceMode ? 'Exit Trace' : 'Trace Boundary'}
|
className="w-full text-left px-3 py-2 hover:bg-gray-50"
|
||||||
</button>
|
onClick={() => {
|
||||||
</div>
|
setShowAddMenu(false);
|
||||||
|
// Enable trace mode, disable points mode
|
||||||
|
setIsGPSPointsMode(false);
|
||||||
|
clearGpsPoints();
|
||||||
|
setIsGPSTraceMode(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Trace Boundary (continuous)
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-1 lg:grid-cols-4 gap-6">
|
<div className="grid grid-cols-1 lg:grid-cols-4 gap-6">
|
||||||
|
|||||||
Reference in New Issue
Block a user