mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 18:55:23 +03:00
fix merging fuckup
This commit is contained in:
parent
c243c143c3
commit
2b61d0d997
@ -95,10 +95,34 @@ export default function CameraMasks({ camera }) {
|
|||||||
[motionMaskPoints, setMotionMaskPoints]
|
[motionMaskPoints, setMotionMaskPoints]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleCopyMotionMasks = useCallback(async () => {
|
const handleCopyMotionMasks = useCallback(() => {
|
||||||
await window.navigator.clipboard.writeText(` motion:
|
const textToCopy = ` motion:
|
||||||
mask:
|
mask:
|
||||||
${motionMaskPoints.map((mask) => ` - ${polylinePointsToPolyline(mask)}`).join('\n')}`);
|
${motionMaskPoints.map((mask) => ` - ${polylinePointsToPolyline(mask)}`).join('\n')}`;
|
||||||
|
|
||||||
|
if (window.navigator.clipboard && window.navigator.clipboard.writeText) {
|
||||||
|
// Use Clipboard API if available
|
||||||
|
window.navigator.clipboard.writeText(textToCopy).catch((err) => {
|
||||||
|
// console.error('Failed to copy text: ', err);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Fallback to document.execCommand('copy')
|
||||||
|
const textarea = document.createElement('textarea');
|
||||||
|
textarea.value = textToCopy;
|
||||||
|
document.body.appendChild(textarea);
|
||||||
|
textarea.select();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const successful = document.execCommand('copy');
|
||||||
|
if (!successful) {
|
||||||
|
throw new Error('Failed to copy text');
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
//console.error('Failed to copy text: ', err);
|
||||||
|
}
|
||||||
|
|
||||||
|
document.body.removeChild(textarea);
|
||||||
|
}
|
||||||
}, [motionMaskPoints]);
|
}, [motionMaskPoints]);
|
||||||
|
|
||||||
const handleSaveMotionMasks = useCallback(async () => {
|
const handleSaveMotionMasks = useCallback(async () => {
|
||||||
@ -113,7 +137,7 @@ ${motionMaskPoints.map((mask) => ` - ${polylinePointsToPolyline(mask)}`).jo
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// handle error
|
// handle error
|
||||||
|
//console.error(error);
|
||||||
}
|
}
|
||||||
}, [motionMaskPoints]);
|
}, [motionMaskPoints]);
|
||||||
|
|
||||||
@ -144,11 +168,11 @@ ${motionMaskPoints.map((mask) => ` - ${polylinePointsToPolyline(mask)}`).jo
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleCopyZones = useCallback(async () => {
|
const handleCopyZones = useCallback(async () => {
|
||||||
await window.navigator.clipboard.writeText(` zones:
|
const textToCopy = ` zones:
|
||||||
${Object.keys(zonePoints)
|
${Object.keys(zonePoints)
|
||||||
.map(
|
.map(
|
||||||
(zoneName) => ` ${zoneName}:
|
(zoneName) => ` ${zoneName}:
|
||||||
coordinates: ${polylinePointsToPolyline(zonePoints[zoneName])}`).join('\n')}`);
|
coordinates: ${polylinePointsToPolyline(zonePoints[zoneName])}`).join('\n')}`;
|
||||||
|
|
||||||
if (window.navigator.clipboard && window.navigator.clipboard.writeText) {
|
if (window.navigator.clipboard && window.navigator.clipboard.writeText) {
|
||||||
// Use Clipboard API if available
|
// Use Clipboard API if available
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user