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