feat: 优化 write 页面的列表展示

This commit is contained in:
richarjiang
2026-06-01 11:36:44 +08:00
parent 8d2fbbbcf0
commit b9f3dce173
3 changed files with 69 additions and 42 deletions

View File

@@ -4066,6 +4066,9 @@
},
{
"__id__": 172
},
{
"__id__": 233
}
],
"_prefab": {
@@ -4523,12 +4526,12 @@
"__prefab": {
"__id__": 192
},
"_alignFlags": 1,
"_alignFlags": 5,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 255.272,
"_bottom": 0,
"_bottom": 752.53,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
@@ -5486,5 +5489,41 @@
"fileId": "c46/YsCPVOJYA4mWEpNYRx",
"instance": null,
"targetOverrides": null
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 167
},
"_enabled": true,
"__prefab": {
"__id__": 234
},
"_alignFlags": 45,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 940,
"_originalHeight": 1300,
"_alignMode": 2,
"_lockFlags": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "efGg9r8a5Gdr8RY5lZpQMz"
}
]

View File

@@ -148,39 +148,25 @@ export class PageWriteLevels extends BaseView {
}
private _resizeScrollViewport(): void {
if (!this.scrollView || !this._viewTransform || !this.shareTitleEditBox) {
if (!this.scrollView || !this._viewTransform) {
return;
}
const rootTransform = this.node.getComponent(UITransform);
const scrollTransform = this.scrollView.getComponent(UITransform);
const scrollWidget = this.scrollView.getComponent('cc.Widget') as any;
const shareTitleTransform = this.shareTitleEditBox.getComponent(UITransform);
const shareTitleWidget = this.shareTitleEditBox.getComponent('cc.Widget') as any;
const bottomMaskNode = this.scrollView.getChildByName('ScrolViewMask');
const viewWidget = this._viewTransform.node.getComponent('cc.Widget') as any;
if (!rootTransform || !scrollTransform || !shareTitleTransform || !scrollWidget || !shareTitleWidget) {
if (!scrollTransform) {
return;
}
const topInset = Number(scrollWidget.top ?? 0);
const shareBottomInset = Number(shareTitleWidget.bottom ?? 0);
const shareTitleHeight = shareTitleTransform.height * Math.abs(this.shareTitleEditBox.scale.y);
const nextHeight = Math.max(
LAYOUT_CONFIG.VIEW_HEIGHT,
rootTransform.height - topInset - shareBottomInset - shareTitleHeight - LAYOUT_CONFIG.LIST_BOTTOM_GAP_TO_TITLE,
scrollWidget?.updateAlignment?.();
viewWidget?.updateAlignment?.();
this._viewTransform.setContentSize(
scrollTransform.contentSize.width,
scrollTransform.contentSize.height,
);
scrollTransform.setContentSize(scrollTransform.width, nextHeight);
this._viewTransform.setContentSize(this._viewTransform.width, nextHeight);
if (bottomMaskNode) {
bottomMaskNode.setPosition(
bottomMaskNode.position.x,
-(nextHeight / 2) + 30,
bottomMaskNode.position.z,
);
}
}
private async _initLevelList(): Promise<void> {