!45369 修改chip在大字体的情况下,icon超出chip的问题

Merge pull request !45369 from sunjiakun/chip_1010
This commit is contained in:
openharmony_ci 2024-10-21 07:06:30 +00:00 committed by Gitee
commit 926a592ca5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 20 additions and 2 deletions

View File

@ -512,6 +512,7 @@ export class d1 extends ViewPU {
onConfigurationUpdated: (configuration) => {
this.fontSizeScale = configuration.fontSizeScale;
this.fontWeightScale = configuration.fontWeightScale;
this.isClipable = (this.toVp(this.fontSizeScale) >= this.theme.q1.s1) ? true : false;
},
onMemoryLevel() {},
};
@ -544,6 +545,7 @@ export class d1 extends ViewPU {
);
this.setInitiallyProvidedValue(params);
this.finalizeConstruction();
this.c4 = new ObservedPropertySimplePU(false, this, "isClipable");
}
setInitiallyProvidedValue(params) {
if (params.theme !== undefined) {
@ -651,6 +653,9 @@ export class d1 extends ViewPU {
if (params.symbolEffect !== undefined) {
this.symbolEffect = params.symbolEffect;
}
if (params.isClipable !== undefined) {
this.isClipable = params.isClipable;
}
}
updateStateVars(params) {
this.n2.reset(params.chipSize);
@ -707,6 +712,7 @@ export class d1 extends ViewPU {
this.z3.purgeDependencyOnElmtId(rmElmtId);
this.a4.purgeDependencyOnElmtId(rmElmtId);
this.b4.purgeDependencyOnElmtId(rmElmtId);
this.c4.purgeDependencyOnElmtId(rmElmtId);
}
aboutToBeDeleted() {
this.n2.aboutToBeDeleted();
@ -743,6 +749,7 @@ export class d1 extends ViewPU {
this.z3.aboutToBeDeleted();
this.a4.aboutToBeDeleted();
this.b4.aboutToBeDeleted();
this.c4.aboutToBeDeleted();
SubscriberManager.Get().delete(this.id__());
this.aboutToBeDeletedInternal();
}
@ -950,6 +957,12 @@ export class d1 extends ViewPU {
set symbolEffect(newValue) {
this.b4.set(newValue);
}
get isClipable() {
return this.c4.get();
}
set isClipable(newValue) {
this.c4.set(newValue);
}
isChipSizeEnum() {
return typeof this.chipSize === 'string';
}
@ -1519,6 +1532,7 @@ export class d1 extends ViewPU {
}
return constraintSize;
}
focusOverlay(parent = null) {
this.observeComponentCreation2((elmtId, isInitialRender) => {
Stack.create();
@ -1550,6 +1564,7 @@ export class d1 extends ViewPU {
aboutToAppear() {
let e1 = this.getUIContext();
this.fontSizeScale = e1.getHostContext()?.config?.fontSizeScale ?? 1;
this.isClipable = (this.toVp(this.fontSizeScale) >= this.theme.q1.s1) ? true : false;
this.smListener.on('change', (h1) => {
if (h1.matches) {
this.chipBreakPoints = a1.SM;
@ -1595,7 +1610,7 @@ export class d1 extends ViewPU {
Button.constraintSize(this.getChipConstraintWidth());
Button.direction(this.chipDirection);
Button.type(ButtonType.Normal);
Button.clip(false);
Button.clip(this.isClipable);
Button.backgroundColor(this.getChipNodeBackGroundColor());
Button.borderRadius(this.getChipNodeRadius());
Button.enabled(this.getChipEnable());

View File

@ -398,6 +398,7 @@ export struct ChipComponent {
onConfigurationUpdated: (configuration) => {
this.fontSizeScale = configuration.fontSizeScale;
this.fontWeightScale = configuration.fontWeightScale;
this.isClipable = (this.toVp(this.fontSizeScale) >= this.theme.chipNode.suitAgeScale) ? true : false;
}, onMemoryLevel() {
}
}
@ -409,6 +410,7 @@ export struct ChipComponent {
@State allowCloseSymbolWidth: Length | undefined =
this.toVp(componentUtils.getRectangleById('AllowCloseSymbolGlyph')?.size?.width);
@State symbolEffect: SymbolEffect = new SymbolEffect();
@State isClipable: boolean = false;
private isChipSizeEnum(): boolean {
return typeof (this.chipSize) === 'string'
@ -954,6 +956,7 @@ export struct ChipComponent {
aboutToAppear() {
let uiContent: UIContext = this.getUIContext();
this.fontSizeScale = (uiContent.getHostContext() as common.UIAbilityContext)?.config?.fontSizeScale ?? 1;
this.isClipable = (this.toVp(this.fontSizeScale) >= this.theme.chipNode.suitAgeScale) ? true : false;
this.smListener.on("change", (mediaQueryResult: mediaquery.MediaQueryResult) => {
if (mediaQueryResult.matches) {
this.chipBreakPoints = BreakPointsType.SM
@ -1142,7 +1145,7 @@ export struct ChipComponent {
.constraintSize(this.getChipConstraintWidth())
.direction(this.chipDirection)
.type(ButtonType.Normal)
.clip(false)
.clip(this.isClipable)
.backgroundColor(this.getChipNodeBackGroundColor())
.borderRadius(this.getChipNodeRadius())
.enabled(this.getChipEnable())