feat: 优化 write 页面的列表展示
This commit is contained in:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user