Open wenwst opened 3 years ago
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
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; }
}
在设置ALIGN.TOP时,由于ALIGN.TOP为0,因此,会将verticalAlign改为ALIGN.CENTER