Skip to content

Commit 532fd1e

Browse files
committed
refactor(graphics): simplify device performance checks in ThreeCanvasComponent by removing mobile device detection and adjusting settings based on memory and core count
1 parent 90a95bd commit 532fd1e

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

components/three/canvas.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"use client";
22

3-
import { isMobileDevice } from "@/lib/utils";
43
import { Canvas, type CanvasProps } from "@react-three/fiber";
54
import dynamic from "next/dynamic";
65
import type { ReactNode } from "react";
@@ -21,9 +20,6 @@ function ThreeCanvasComponent({
2120
// Check device pixel ratio and cap it for performance
2221
const devicePixelRatio = window.devicePixelRatio || 1;
2322

24-
// Check if device is mobile
25-
const isMobile = isMobileDevice();
26-
2723
// Check available memory (if supported)
2824
// @ts-expect-error - experimental API
2925
const memory = navigator.deviceMemory;
@@ -32,11 +28,7 @@ function ThreeCanvasComponent({
3228
const cores = navigator.hardwareConcurrency || 4;
3329

3430
// Determine performance profile
35-
if (isMobile || memory < 4 || cores < 4) {
36-
// Low-end device settings
37-
setPixelRatio(Math.min(devicePixelRatio, 1));
38-
setPowerPreference("low-power");
39-
} else if (memory >= 8 && cores >= 8) {
31+
if (memory >= 8 && cores >= 8) {
4032
// High-end device settings
4133
setPixelRatio(Math.min(devicePixelRatio, 2));
4234
setPowerPreference("high-performance");

0 commit comments

Comments
 (0)