Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

AnchorLayoutOptions set verticalAlign and horizontalAlign not work. #64

Open
wenwst opened this issue May 13, 2021 · 0 comments
Open

AnchorLayoutOptions set verticalAlign and horizontalAlign not work. #64

wenwst opened this issue May 13, 2021 · 0 comments

Comments

@wenwst
Copy link

wenwst commented May 13, 2021

class AnchorLayoutOptions extends LayoutOptions {
constructor(options) {
super(options.width, options.height);
this.anchorLeft = options.anchorLeft || 0;
this.anchorTop = options.anchorTop || 0;
this.anchorBottom = options.anchorBottom || 0;
this.anchorRight = options.anchorRight || 0;
this.horizontalAlign = options.horizontalAlign || ALIGN.LEFT;
this.verticalAlign = options.verticalAlign || ALIGN.CENTER;
}

because ALIGN.TOP value is 0, so when i set ALIGN.TOP to verticalAlign, here will be change to ALIGN.CENTER.

here is work.
class AnchorLayoutOptions extends LayoutOptions {
constructor(options) {
super(options.width, options.height);
this.anchorLeft = options.anchorLeft || 0;
this.anchorTop = options.anchorTop || 0;
this.anchorBottom = options.anchorBottom || 0;
this.anchorRight = options.anchorRight || 0;
if (options.horizontalAlign === 0) {
this.horizontalAlign = 0;
} else {
this.horizontalAlign = options.horizontalAlign || ALIGN.LEFT;
}

  if (options.verticalAlign === 0) {
    this.verticalAlign = 0;
  } else {
    this.verticalAlign = options.verticalAlign || ALIGN.CENTER;
  }
}

}

在设置ALIGN.TOP时,由于ALIGN.TOP为0,因此,会将verticalAlign改为ALIGN.CENTER

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant