插件面板尺寸问题

https://docs.cocos.com/creator/3.8/manual/zh/editor/extension/panel.html

文档中的面板定义

{
    "name": "hello-world",
    "panels": {
        "default": {
            "title": "world panel",
            "type": "dockable",
            "main": "./dist/panels/default",
            "icon": "./static/default.png"
        },
        "list": {
            "title": "world list",
            "type": "simple",
            "main": "./dist/panels/list",
            "icon": "./static/list.png",

            "flags": {},
            "size": {}
        }
    }
}

这里边的flags中的save设置成true后,并不会缓存面板尺寸,有什么办法能让用户调整尺寸后,下次打开插件面板尺寸是上次用户调整后的尺寸吗?

已解决

const savedSize = await Editor.Message.request(‘bt-editor’, ‘get-panel-size’);
if (savedSize && savedSize.width && savedSize.height) {
window.resizeTo(savedSize.width, savedSize.height);
}

1赞

楼主这个回复真好:+1:不像有些帖子,问个问题,下面一大堆人帮着找解决方案,最后一句 “已解决” 就完事了,也不把解决方案贴出来

这样窗口会闪一下吗

在我电脑上测试,看起来没闪

论坛嘛,把解决方案贴出来,方便自己也方便他人,何乐而不为呢