sync
This commit is contained in:
parent
8d456dacf7
commit
2834ec8e5d
@ -24,6 +24,14 @@ import {
|
||||
SidebarMenuItem,
|
||||
useSidebar,
|
||||
} from "@/components/ui/sidebar"
|
||||
import { gql, useQuery } from "@apollo/client"
|
||||
import { useEffect } from "react"
|
||||
|
||||
const CATE = gql`
|
||||
query GetCategories {
|
||||
settingCategories
|
||||
}
|
||||
`
|
||||
|
||||
export function NavDocuments({
|
||||
items,
|
||||
@ -36,16 +44,18 @@ export function NavDocuments({
|
||||
}) {
|
||||
const { isMobile } = useSidebar()
|
||||
|
||||
const { data, loading, error } = useQuery(CATE)
|
||||
|
||||
return (
|
||||
<SidebarGroup className="group-data-[collapsible=icon]:hidden">
|
||||
<SidebarGroupLabel>Documents</SidebarGroupLabel>
|
||||
<SidebarGroupLabel>Categories</SidebarGroupLabel>
|
||||
<SidebarMenu>
|
||||
{items.map((item) => (
|
||||
<SidebarMenuItem key={item.name}>
|
||||
{data && data.settingCategories.map((item: string) => (
|
||||
<SidebarMenuItem key={item}>
|
||||
<SidebarMenuButton asChild>
|
||||
<a href={item.url}>
|
||||
<item.icon />
|
||||
<span>{item.name}</span>
|
||||
<a href={`/admin/category/${item}`}>
|
||||
<IconFolder />
|
||||
<span>{item}</span>
|
||||
</a>
|
||||
</SidebarMenuButton>
|
||||
<DropdownMenu>
|
||||
|
||||
@ -142,7 +142,16 @@ export function MapComponent({
|
||||
}
|
||||
|
||||
vec4 texColor = texture(u_tex, uv);
|
||||
|
||||
float real_value = texColor.r * 255.0;
|
||||
|
||||
if (real_value <= 0.0 || real_value >= 75.0) {
|
||||
discard;
|
||||
}
|
||||
|
||||
float value = texColor.r * 3.4;
|
||||
|
||||
|
||||
value = clamp(value, 0.0, 1.0);
|
||||
|
||||
// 软阈值,避免全场被 return
|
||||
|
||||
@ -266,21 +266,10 @@ export function createMeteorologicalColorMap(): Uint8Array {
|
||||
for (let j = 0; j < colorRanges.length; j++) {
|
||||
const range = colorRanges[j];
|
||||
if (value >= range.range[0] && value <= range.range[1]) {
|
||||
// 在区间内进行线性插值
|
||||
const localT = (value - range.range[0]) / (range.range[1] - range.range[0]);
|
||||
|
||||
if (j < colorRanges.length - 1) {
|
||||
const nextRange = colorRanges[j + 1];
|
||||
// 与下一个颜色进行插值
|
||||
r = Math.floor(range.color[0] + localT * (nextRange.color[0] - range.color[0]));
|
||||
g = Math.floor(range.color[1] + localT * (nextRange.color[1] - range.color[1]));
|
||||
b = Math.floor(range.color[2] + localT * (nextRange.color[2] - range.color[2]));
|
||||
} else {
|
||||
// 最后一个区间,使用固定颜色
|
||||
// 使用区间的固定颜色,不进行插值
|
||||
r = range.color[0];
|
||||
g = range.color[1];
|
||||
b = range.color[2];
|
||||
}
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user