fix: remove alpha filters in block selectors

major performance issues (fps 90 to 40 on firefox)
This commit is contained in:
trafficlunar 2025-02-21 15:17:35 +00:00
parent c922b4223c
commit aed52abd22
2 changed files with 3 additions and 4 deletions

View file

@ -1,6 +1,5 @@
import React, { useContext, useMemo, useRef, useState } from "react";
import { Container, Graphics, Sprite, Stage } from "@pixi/react";
import { AlphaFilter } from "pixi.js";
import { CanvasContext } from "@/context/Canvas";
import { ThemeContext } from "@/context/Theme";
@ -71,7 +70,7 @@ function BlockSelector({ stageWidth, searchInput, selectedBlocks, setSelectedBlo
eventMode={"static"}
pointerover={() => setHoverPosition({ x, y })}
click={() => onClick(block)}
filters={selectedBlocks.includes(block) ? [] : [new AlphaFilter(0.2)]}
alpha={0.2}
/>
{selectedBlocks.includes(block) && (

View file

@ -8,7 +8,7 @@ import { ToolContext } from "@/context/Tool";
import { useBlockData } from "@/hooks/useBlockData";
import { useTextures } from "@/hooks/useTextures";
import { AlphaFilter, Application } from "pixi.js";
import { Application } from "pixi.js";
interface Props {
stageWidth: number;
@ -92,7 +92,7 @@ function BlockSelector({ stageWidth, searchInput }: Props) {
mouseover={() => setHoverPosition({ x, y })}
click={onClick}
tap={onClick}
filters={selectedBlock == block ? [] : [new AlphaFilter(0.3)]}
alpha={0.3}
/>
);
})}