mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
oops
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -11,7 +11,7 @@
|
|||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||||
<meta name="apple-mobile-web-app-title" content="Multi Roomba Rover" />
|
<meta name="apple-mobile-web-app-title" content="Multi Roomba Rover" />
|
||||||
<title>Multi Roomba Rover</title>
|
<title>Multi Roomba Rover</title>
|
||||||
<script type="module" crossorigin src="/assets/index-DAIbNlvO.js"></script>
|
<script type="module" crossorigin src="/assets/index-DgooAI0x.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-HhAzSaxc.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-HhAzSaxc.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -108,6 +108,17 @@ export default function VideoTile({
|
|||||||
const auxCap = Number.isFinite(limiterCaps?.aux?.cap) ? limiterCaps.aux.cap : 1;
|
const auxCap = Number.isFinite(limiterCaps?.aux?.cap) ? limiterCaps.aux.cap : 1;
|
||||||
return Math.max(0, Math.min(1, 1 - Math.min(driveCap, auxCap)));
|
return Math.max(0, Math.min(1, 1 - Math.min(driveCap, auxCap)));
|
||||||
}, [limiterCaps]);
|
}, [limiterCaps]);
|
||||||
|
const overcurrentActive = Boolean(
|
||||||
|
(limiterGroups?.drive || limiterGroups?.aux) || overcurrentMotors.length,
|
||||||
|
);
|
||||||
|
const overlayFill = overcurrentLimiter
|
||||||
|
? limiterFill ?? 0
|
||||||
|
: overcurrentMotors.length
|
||||||
|
? 1
|
||||||
|
: 0;
|
||||||
|
const overlayOpacity = clampUnit(
|
||||||
|
overcurrentActive ? Math.max(overlayFill * 1.2, 0.25) : overlayFill * 1.2,
|
||||||
|
);
|
||||||
const overcurrentLabels = useMemo(() => {
|
const overcurrentLabels = useMemo(() => {
|
||||||
if (!overcurrentLimiter) {
|
if (!overcurrentLimiter) {
|
||||||
return overcurrentMotors.map((name) => OVERCURRENT_LABELS[name] || name);
|
return overcurrentMotors.map((name) => OVERCURRENT_LABELS[name] || name);
|
||||||
@@ -449,7 +460,8 @@ export default function VideoTile({
|
|||||||
<HudChatInput compact={mobileHud} />
|
<HudChatInput compact={mobileHud} />
|
||||||
<OvercurrentOverlay
|
<OvercurrentOverlay
|
||||||
labels={overcurrentLabels}
|
labels={overcurrentLabels}
|
||||||
fill={overcurrentLimiter ? limiterFill ?? 0 : overcurrentMotors.length ? 1 : 0}
|
fill={overlayFill}
|
||||||
|
opacity={overlayOpacity}
|
||||||
compact={mobileHud}
|
compact={mobileHud}
|
||||||
/>
|
/>
|
||||||
<LowBatteryOverlay charge={batteryCharge} config={batteryConfig} compact={mobileHud} />
|
<LowBatteryOverlay charge={batteryCharge} config={batteryConfig} compact={mobileHud} />
|
||||||
@@ -751,17 +763,17 @@ const OVERCURRENT_LABELS = {
|
|||||||
sideBrush: 'Side brush',
|
sideBrush: 'Side brush',
|
||||||
};
|
};
|
||||||
|
|
||||||
function OvercurrentOverlay({ labels, fill = 0, compact = false }) {
|
function OvercurrentOverlay({ labels, fill = 0, opacity = 1, compact = false }) {
|
||||||
if (!labels?.length) return null;
|
if (!labels?.length) return null;
|
||||||
const containerClass = compact ? 'p-2' : 'p-4';
|
const containerClass = compact ? 'p-2' : 'p-4';
|
||||||
const textClass = compact ? 'text-lg' : 'text-4xl';
|
const textClass = compact ? 'text-lg' : 'text-4xl';
|
||||||
const subTextClass = compact ? 'text-xs' : 'text-xl';
|
const subTextClass = compact ? 'text-xs' : 'text-xl';
|
||||||
const fillWidth = `${Math.round(clampUnit(fill) * 100)}%`;
|
const fillWidth = `${Math.round(clampUnit(fill) * 100)}%`;
|
||||||
const opacity = clampUnit(fill * 1.2);
|
const resolvedOpacity = clampUnit(opacity);
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`pointer-events-none absolute flex items-center justify-center bg-red-900/60 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 ${containerClass} relative`}
|
className={`pointer-events-none absolute flex items-center justify-center bg-red-900/60 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 ${containerClass} relative`}
|
||||||
style={{ opacity }}
|
style={{ opacity: resolvedOpacity }}
|
||||||
>
|
>
|
||||||
<div className="absolute inset-0 overflow-hidden">
|
<div className="absolute inset-0 overflow-hidden">
|
||||||
<div className="h-full bg-red-700/60" style={{ width: fillWidth }} />
|
<div className="h-full bg-red-700/60" style={{ width: fillWidth }} />
|
||||||
|
|||||||
Reference in New Issue
Block a user