Skip to content

Commit 4a69622

Browse files
committed
Refresh Workspace
1 parent 00484b5 commit 4a69622

3 files changed

Lines changed: 10 additions & 11 deletions

File tree

src/addons/addons/show-fps/userscript.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import addSmallStageClass from "../../libraries/common/cs/small-stage.js";
22

3-
export default async function ({ addon, console }) {
3+
export default async function ({ addon }) {
44
// 创建 FPS 显示容器
55
const fpsContainerContainer = document.createElement("div");
66
addon.tab.displayNoneWhileDisabled(fpsContainerContainer, { display: "flex" });
@@ -16,31 +16,26 @@ export default async function ({ addon, console }) {
1616

1717
const vm = addon.tab.traps.vm;
1818

19-
// FPS 计算逻辑 - 参考 debugger/performance.js
2019
const renderTimes = [];
2120
let lastFpsTime = performance.now();
2221
let currentFps = 60;
23-
let updateInterval = null;
2422

2523
const updateFps = () => {
2624
if (addon.self.disabled) return;
2725

2826
const now = performance.now();
2927

30-
// 移除超过 1 秒的帧时间记录
3128
while (renderTimes.length > 0 && renderTimes[0] <= now - 1000) {
3229
renderTimes.shift();
3330
}
3431
renderTimes.push(now);
3532

36-
// 每秒更新一次显示
3733
if (now - lastFpsTime >= 1000) {
3834
lastFpsTime = now;
3935

40-
// 获取目标帧率
4136
const maxFps = vm.runtime.frameLoop.framerate === 0 ? 60 : vm.runtime.frameLoop.framerate;
4237
currentFps = Math.min(renderTimes.length, maxFps);
43-
fpsText.style.color = currentFps > maxFps * 0.7 ? "#82c1ff" : (
38+
fpsText.style.color = currentFps > maxFps * 0.7 ? "var(--looks-secondary)" : (
4439
currentFps > maxFps * 0.5 ? "#82ff97" : (
4540
currentFps > maxFps * 0.2 ? "rgb(255, 197, 130)" : "rgb(255, 130, 130)"
4641
)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const getSetting = (id) => {
2+
const settings = JSON.parse(localStorage.getItem('AEsettings')) || {};
3+
if(!settings[id]) return false;
4+
return settings[id];
5+
}

src/addons/ui/side-bar/side-bar.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ const pluginRegistry = new Map();
1111
// 当前活动的插件名称
1212
let activePlugin = null;
1313

14-
/**
15-
* 适用于Addons的侧边栏 - 简化版
16-
* 移除所有复杂的自动调整逻辑,只保留基本功能
17-
*/
1814
export default class SideBar {
1915
constructor(element) {
2016
// 如果传入元素,使用旧 API 模式
@@ -370,20 +366,23 @@ class SideBarInternal {
370366
document.body.style.cursor = "";
371367
document.body.style.userSelect = "";
372368
}
369+
window.dispatchEvent(new Event("resize"));
373370
}
374371

375372
open() {
376373
this.element.style.display = "flex";
377374
if (this.extensionButton) {
378375
this.extensionButton.style.marginLeft = this.currentWidth + "px";
379376
}
377+
window.dispatchEvent(new Event("resize"));
380378
}
381379

382380
close() {
383381
this.element.style.display = "none";
384382
if (this.extensionButton) {
385383
this.extensionButton.style.marginLeft = "0px";
386384
}
385+
window.dispatchEvent(new Event("resize"));
387386
}
388387

389388
isOpen() {

0 commit comments

Comments
 (0)