Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -499,15 +499,16 @@ class CameraDropdown(gr.HTML):
|
|
| 499 |
}
|
| 500 |
|
| 501 |
function setValue(val, shouldTrigger = false) {
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
|
| 510 |
-
|
|
|
|
| 511 |
}
|
| 512 |
|
| 513 |
// Toggle menu
|
|
@@ -995,74 +996,106 @@ css += """
|
|
| 995 |
}
|
| 996 |
|
| 997 |
/* 4) Ensure menu overlays neighbors and isn't clipped */
|
|
|
|
| 998 |
.cd-menu{
|
| 999 |
-
|
| 1000 |
-
|
| 1001 |
-
|
| 1002 |
-
|
| 1003 |
-
|
| 1004 |
-
|
| 1005 |
-
|
| 1006 |
-
|
| 1007 |
-
|
| 1008 |
-
|
| 1009 |
-
|
| 1010 |
-
|
| 1011 |
-
|
| 1012 |
-
|
| 1013 |
-
|
| 1014 |
-
|
| 1015 |
-
|
| 1016 |
-
}
|
| 1017 |
-
|
| 1018 |
-
.cd-menu.open{
|
| 1019 |
-
opacity: 1;
|
| 1020 |
-
transform: translateY(0);
|
| 1021 |
-
pointer-events: auto;
|
| 1022 |
}
|
| 1023 |
|
| 1024 |
.cd-title{
|
| 1025 |
-
|
| 1026 |
-
|
| 1027 |
-
|
| 1028 |
-
|
| 1029 |
-
|
| 1030 |
-
|
|
|
|
|
|
|
|
|
|
| 1031 |
}
|
| 1032 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1033 |
.cd-items{
|
| 1034 |
-
|
| 1035 |
-
|
| 1036 |
-
|
| 1037 |
}
|
| 1038 |
-
|
|
|
|
| 1039 |
.cd-item{
|
| 1040 |
-
|
| 1041 |
-
|
| 1042 |
-
|
| 1043 |
-
|
| 1044 |
-
|
| 1045 |
-
|
| 1046 |
-
|
| 1047 |
-
|
| 1048 |
-
|
| 1049 |
-
|
| 1050 |
-
|
|
|
|
|
|
|
|
|
|
| 1051 |
}
|
| 1052 |
-
|
|
|
|
| 1053 |
.cd-item:hover{
|
| 1054 |
-
|
| 1055 |
}
|
| 1056 |
-
|
| 1057 |
-
|
| 1058 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1059 |
}
|
| 1060 |
|
|
|
|
|
|
|
| 1061 |
.cd-item.selected{
|
| 1062 |
-
|
| 1063 |
-
|
| 1064 |
}
|
| 1065 |
|
|
|
|
| 1066 |
"""
|
| 1067 |
|
| 1068 |
|
|
|
|
| 499 |
}
|
| 500 |
|
| 501 |
function setValue(val, shouldTrigger = false) {
|
| 502 |
+
const v = (val ?? "None");
|
| 503 |
+
props.value = v;
|
| 504 |
+
triggerText.textContent = v;
|
| 505 |
+
|
| 506 |
+
// mark selected (for CSS tick)
|
| 507 |
+
items.forEach(btn => {
|
| 508 |
+
btn.dataset.selected = (btn.dataset.value === v) ? "true" : "false";
|
| 509 |
+
});
|
| 510 |
+
|
| 511 |
+
if (shouldTrigger) trigger("change", props.value);
|
| 512 |
}
|
| 513 |
|
| 514 |
// Toggle menu
|
|
|
|
| 996 |
}
|
| 997 |
|
| 998 |
/* 4) Ensure menu overlays neighbors and isn't clipped */
|
| 999 |
+
/* Move dropdown a tiny bit up (closer to the trigger) */
|
| 1000 |
.cd-menu{
|
| 1001 |
+
position: absolute;
|
| 1002 |
+
top: calc(100% + 4px); /* was +10px */
|
| 1003 |
+
left: 0;
|
| 1004 |
+
|
| 1005 |
+
min-width: 240px;
|
| 1006 |
+
background: #2b2b2b;
|
| 1007 |
+
border: 1px solid rgba(255,255,255,0.14);
|
| 1008 |
+
border-radius: 14px;
|
| 1009 |
+
box-shadow: 0 18px 40px rgba(0,0,0,0.35);
|
| 1010 |
+
padding: 10px;
|
| 1011 |
+
|
| 1012 |
+
opacity: 0;
|
| 1013 |
+
transform: translateY(-6px);
|
| 1014 |
+
pointer-events: none;
|
| 1015 |
+
transition: opacity 160ms ease, transform 160ms ease;
|
| 1016 |
+
|
| 1017 |
+
z-index: 9999;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1018 |
}
|
| 1019 |
|
| 1020 |
.cd-title{
|
| 1021 |
+
font-size: 12px;
|
| 1022 |
+
font-weight: 600;
|
| 1023 |
+
text-transform: uppercase;
|
| 1024 |
+
letter-spacing: 0.04em;
|
| 1025 |
+
|
| 1026 |
+
color: rgba(255,255,255,0.45); /* 👈 muted grey */
|
| 1027 |
+
margin-bottom: 6px;
|
| 1028 |
+
padding: 0 6px;
|
| 1029 |
+
pointer-events: none; /* title is non-interactive */
|
| 1030 |
}
|
| 1031 |
+
|
| 1032 |
+
|
| 1033 |
+
.cd-menu.open{
|
| 1034 |
+
opacity: 1;
|
| 1035 |
+
transform: translateY(0);
|
| 1036 |
+
pointer-events: auto;
|
| 1037 |
+
}
|
| 1038 |
+
|
| 1039 |
.cd-items{
|
| 1040 |
+
display: flex;
|
| 1041 |
+
flex-direction: column;
|
| 1042 |
+
gap: 0px; /* tighter, more like a native menu */
|
| 1043 |
}
|
| 1044 |
+
|
| 1045 |
+
/* Items: NO "boxed" buttons by default */
|
| 1046 |
.cd-item{
|
| 1047 |
+
width: 100%;
|
| 1048 |
+
text-align: left;
|
| 1049 |
+
border: none;
|
| 1050 |
+
background: transparent; /* ✅ removes box look */
|
| 1051 |
+
color: rgba(255,255,255,0.92);
|
| 1052 |
+
padding: 8px 34px 8px 12px; /* right padding leaves room for tick */
|
| 1053 |
+
border-radius: 10px; /* only matters on hover */
|
| 1054 |
+
cursor: pointer;
|
| 1055 |
+
|
| 1056 |
+
font-size: 14px;
|
| 1057 |
+
font-weight: 700;
|
| 1058 |
+
|
| 1059 |
+
position: relative;
|
| 1060 |
+
transition: background 120ms ease;
|
| 1061 |
}
|
| 1062 |
+
|
| 1063 |
+
/* “Box effect” only on hover (not always) */
|
| 1064 |
.cd-item:hover{
|
| 1065 |
+
background: rgba(255,255,255,0.08);
|
| 1066 |
}
|
| 1067 |
+
|
| 1068 |
+
/* Tick on the right ONLY on hover */
|
| 1069 |
+
.cd-item::after{
|
| 1070 |
+
content: "✓";
|
| 1071 |
+
position: absolute;
|
| 1072 |
+
right: 12px;
|
| 1073 |
+
top: 50%;
|
| 1074 |
+
transform: translateY(-50%);
|
| 1075 |
+
opacity: 0; /* hidden by default */
|
| 1076 |
+
transition: opacity 120ms ease;
|
| 1077 |
+
color: rgba(255,255,255,0.9);
|
| 1078 |
+
font-weight: 900;
|
| 1079 |
+
}
|
| 1080 |
+
|
| 1081 |
+
/* show tick ONLY for selected item */
|
| 1082 |
+
.cd-item[data-selected="true"]::after{
|
| 1083 |
+
opacity: 1;
|
| 1084 |
+
}
|
| 1085 |
+
|
| 1086 |
+
/* keep hover box effect, but no tick change */
|
| 1087 |
+
.cd-item:hover{
|
| 1088 |
+
background: rgba(255,255,255,0.08);
|
| 1089 |
}
|
| 1090 |
|
| 1091 |
+
|
| 1092 |
+
/* Kill any old “selected” styling just in case */
|
| 1093 |
.cd-item.selected{
|
| 1094 |
+
background: transparent !important;
|
| 1095 |
+
border: none !important;
|
| 1096 |
}
|
| 1097 |
|
| 1098 |
+
|
| 1099 |
"""
|
| 1100 |
|
| 1101 |
|