fix: TypeScript build errors in Docker
- useRef(null) initial values for Strict TS 6.0 - Removed deprecated transparent option in pixi v7 - Cast Live2DModel to any for addChild type compat - Cast coreModel for getTexture access - Fixed types/index.ts import path to scenes - Added vite-env.d.ts with CSS module declarations - Added null-coalesce for clearInterval calls
This commit is contained in:
@@ -28,7 +28,7 @@ export default function KiraAvatar(props: Props) {
|
||||
const modelRef = useRef<any>(null);
|
||||
const textureRef = useRef<any>(null);
|
||||
const lipSyncRef = useRef<number>(0);
|
||||
const idleExprRef = useRef<ReturnType<typeof setInterval>>();
|
||||
const idleExprRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
||||
const [live2dReady, setLive2dReady] = useState(false);
|
||||
const [loadError, setLoadError] = useState(false);
|
||||
const [currentExpression, setCurrentExpression] = useState<ExpressionName>('Normal');
|
||||
@@ -56,7 +56,6 @@ export default function KiraAvatar(props: Props) {
|
||||
const app = new Application({
|
||||
width: size,
|
||||
height: size * 1.25,
|
||||
transparent: true,
|
||||
antialias: true,
|
||||
resolution: Math.min(window.devicePixelRatio || 1, 2),
|
||||
backgroundAlpha: 0,
|
||||
@@ -80,13 +79,13 @@ export default function KiraAvatar(props: Props) {
|
||||
model.anchor.set(0.5, 0.5);
|
||||
model.position.set(app.screen.width / 2, app.screen.height / 2 + 6);
|
||||
|
||||
app.stage.addChild(model);
|
||||
app.stage.addChild(model as any);
|
||||
|
||||
// Store reference to texture_02 for outfit swapping
|
||||
try {
|
||||
textureRef.current = {
|
||||
index: 2,
|
||||
original: model.internalModel.coreModel.getTexture(2),
|
||||
original: (model.internalModel.coreModel as any).getTexture(2),
|
||||
};
|
||||
} catch { /* ignore */ }
|
||||
|
||||
@@ -113,7 +112,7 @@ export default function KiraAvatar(props: Props) {
|
||||
return () => {
|
||||
mounted = false;
|
||||
cancelAnimationFrame(lipSyncRef.current);
|
||||
clearInterval(idleExprRef.current);
|
||||
clearInterval(idleExprRef.current ?? undefined);
|
||||
if (appRef.current) {
|
||||
appRef.current.destroy(true, { children: true });
|
||||
appRef.current = null;
|
||||
|
||||
Reference in New Issue
Block a user