Frontend performance and code quality improvements
Performance: cache getBoundingClientRect in card-glare and drag-drop, build adjacency Maps for O(1) graph BFS, batch WebGL uniform uploads, cache matchMedia/search text in card-sections, use Map in graph-layout. Code quality: extract shared FPS chart factory (chart-utils.js) and FilterListManager (filter-list.js), replace 14-way CSS editor dispatch with type handler registry, move state to state.js, fix layer violation in api.js, add i18n for hardcoded strings, sync 53 missing locale keys, add HTTP error logging in DataCache. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
} from '../core/icons.js';
|
||||
import { loadScenePresets, renderScenePresetsSection } from './scene-presets.js';
|
||||
import { cardColorStyle } from '../core/card-colors.js';
|
||||
import { createFpsSparkline } from '../core/chart-utils.js';
|
||||
|
||||
const DASHBOARD_COLLAPSED_KEY = 'dashboard_collapsed';
|
||||
const MAX_FPS_SAMPLES = 120;
|
||||
@@ -88,44 +89,7 @@ function _destroyFpsCharts() {
|
||||
}
|
||||
|
||||
function _createFpsChart(canvasId, actualHistory, currentHistory, fpsTarget) {
|
||||
const canvas = document.getElementById(canvasId);
|
||||
if (!canvas) return null;
|
||||
return new Chart(canvas, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: actualHistory.map(() => ''),
|
||||
datasets: [
|
||||
{
|
||||
data: [...actualHistory],
|
||||
borderColor: '#2196F3',
|
||||
backgroundColor: 'rgba(33,150,243,0.12)',
|
||||
borderWidth: 1.5,
|
||||
tension: 0.3,
|
||||
fill: true,
|
||||
pointRadius: 0,
|
||||
},
|
||||
{
|
||||
data: [...currentHistory],
|
||||
borderColor: '#4CAF50',
|
||||
borderWidth: 1.5,
|
||||
tension: 0.3,
|
||||
fill: false,
|
||||
pointRadius: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
animation: false,
|
||||
plugins: { legend: { display: false }, tooltip: { enabled: false } },
|
||||
scales: {
|
||||
x: { display: false },
|
||||
y: { min: 0, max: fpsTarget * 1.15, display: false },
|
||||
},
|
||||
layout: { padding: 0 },
|
||||
},
|
||||
});
|
||||
return createFpsSparkline(canvasId, actualHistory, currentHistory, fpsTarget);
|
||||
}
|
||||
|
||||
async function _initFpsCharts(runningTargetIds) {
|
||||
|
||||
Reference in New Issue
Block a user