Revert "popup_state_variable"

This reverts commit 40c33a08c2.

Signed-off-by: worker0217 <linhao54@huawei.com>
This commit is contained in:
worker0217 2024-09-29 21:31:54 +08:00
parent 6e69621cf0
commit d2cab502d2
2 changed files with 18 additions and 27 deletions

View File

@ -251,7 +251,7 @@ export class PopupComponent extends ViewPU {
this.__buttonHeight = new ObservedPropertySimplePU(0, this, "buttonHeight");
this.__messageMaxWeight = new ObservedPropertyObjectPU(0, this, "messageMaxWeight");
this.__beforeScreenStatus = new ObservedPropertySimplePU(undefined, this, "beforeScreenStatus");
this.__screenChanged = new ObservedPropertySimplePU(true, this, "screenChanged");
this.__currentScreenStatus = new ObservedPropertySimplePU(true, this, "currentScreenStatus");
this.__applySizeOptions = new ObservedPropertyObjectPU(undefined, this, "applySizeOptions");
this.__closeButtonBackgroundColor = new ObservedPropertyObjectPU({
"id": -1,
@ -329,8 +329,8 @@ export class PopupComponent extends ViewPU {
if (k29.beforeScreenStatus !== undefined) {
this.beforeScreenStatus = k29.beforeScreenStatus;
}
if (k29.screenChanged !== undefined) {
this.screenChanged = k29.screenChanged;
if (k29.currentScreenStatus !== undefined) {
this.currentScreenStatus = k29.currentScreenStatus;
}
if (k29.applySizeOptions !== undefined) {
this.applySizeOptions = k29.applySizeOptions;
@ -373,7 +373,7 @@ export class PopupComponent extends ViewPU {
this.__buttonHeight.purgeDependencyOnElmtId(i29);
this.__messageMaxWeight.purgeDependencyOnElmtId(i29);
this.__beforeScreenStatus.purgeDependencyOnElmtId(i29);
this.__screenChanged.purgeDependencyOnElmtId(i29);
this.__currentScreenStatus.purgeDependencyOnElmtId(i29);
this.__applySizeOptions.purgeDependencyOnElmtId(i29);
this.__closeButtonBackgroundColor.purgeDependencyOnElmtId(i29);
this.__firstButtonBackgroundColor.purgeDependencyOnElmtId(i29);
@ -393,7 +393,7 @@ export class PopupComponent extends ViewPU {
this.__buttonHeight.aboutToBeDeleted();
this.__messageMaxWeight.aboutToBeDeleted();
this.__beforeScreenStatus.aboutToBeDeleted();
this.__screenChanged.aboutToBeDeleted();
this.__currentScreenStatus.aboutToBeDeleted();
this.__applySizeOptions.aboutToBeDeleted();
this.__closeButtonBackgroundColor.aboutToBeDeleted();
this.__firstButtonBackgroundColor.aboutToBeDeleted();
@ -491,12 +491,12 @@ export class PopupComponent extends ViewPU {
this.__beforeScreenStatus.set(x28);
}
get screenChanged() {
return this.__screenChanged.get();
get currentScreenStatus() {
return this.__currentScreenStatus.get();
}
set screenChanged(w28) {
this.__screenChanged.set(w28);
set currentScreenStatus(w28) {
this.__currentScreenStatus.set(w28);
}
get applySizeOptions() {
@ -771,14 +771,7 @@ export class PopupComponent extends ViewPU {
aboutToAppear() {
this.listener.on("change", (l28) => {
if (l28.matches !== this.beforeScreenStatus) {
this.applySizeOptions = this.getApplyMaxSize();
this.beforeScreenStatus = l28.matches;
this.screenChanged = true;
}
else {
this.screenChanged = false;
}
this.currentScreenStatus = l28.matches;
});
}
@ -788,7 +781,9 @@ export class PopupComponent extends ViewPU {
getScrollMaxHeight() {
let j28 = undefined;
if (this.screenChanged) {
if (this.currentScreenStatus !== this.beforeScreenStatus) {
this.applySizeOptions = this.getApplyMaxSize();
this.beforeScreenStatus = this.currentScreenStatus;
return j28;
}
j28 = this.applyHeight;

View File

@ -222,7 +222,7 @@ export struct PopupComponent {
@State buttonHeight: number = 0;
@State messageMaxWeight: number | undefined = 0;
@State beforeScreenStatus: boolean | undefined = undefined;
@State screenChanged: boolean = false;
@State currentScreenStatus: boolean = true;
@State applySizeOptions: ConstraintSizeOptions | undefined = undefined;
@State closeButtonBackgroundColor: ResourceColor = $r('sys.color.ohos_id_color_background_transparent');
@State firstButtonBackgroundColor: ResourceColor = $r('sys.color.ohos_id_color_background_transparent');
@ -459,13 +459,7 @@ export struct PopupComponent {
aboutToAppear() {
this.listener.on("change", (mediaQueryResult: mediaquery.MediaQueryResult) => {
if (mediaQueryResult.matches !== this.beforeScreenStatus) {
this.applySizeOptions = this.getApplyMaxSize();
this.beforeScreenStatus = mediaQueryResult.matches;
this.screenChanged = true;
} else {
this.screenChanged = false;
}
this.currentScreenStatus = mediaQueryResult.matches
})
}
@ -475,7 +469,9 @@ export struct PopupComponent {
getScrollMaxHeight(): number | undefined {
let scrollMaxHeight: number | undefined = undefined;
if (this.screenChanged) {
if (this.currentScreenStatus !== this.beforeScreenStatus) {
this.applySizeOptions = this.getApplyMaxSize();
this.beforeScreenStatus = this.currentScreenStatus
return scrollMaxHeight;
}
scrollMaxHeight = this.applyHeight