fix:web VLayout、HLayout margin

This commit is contained in:
wangxiangyuan
2023-09-11 11:40:02 +08:00
committed by osborn
parent b087730090
commit b430dbbbda
4 changed files with 9 additions and 9 deletions

View File

@@ -43,9 +43,9 @@ export class DoricHLayoutNode extends DoricGroupViewNode {
e.view.style.flex = `${e.layoutConfig?.weight}`
}
e.view.style.marginLeft = toPixelString(e.layoutConfig?.margin?.left || 0)
const rightMargin = e.layoutConfig?.margin?.right || 0
e.view.style.marginRight = toPixelString(
(idx === this.childNodes.length - 1) ? 0 : this.space
+ (e.layoutConfig?.margin?.right || 0))
(idx === this.childNodes.length - 1) ? rightMargin : this.space + rightMargin)
e.view.style.marginTop = toPixelString(e.layoutConfig?.margin?.top || 0)
e.view.style.marginBottom = toPixelString(e.layoutConfig?.margin?.bottom || 0)
if ((e.layoutConfig.alignment & TOP) === TOP) {

View File

@@ -43,9 +43,9 @@ export class DoricVLayoutNode extends DoricGroupViewNode {
e.view.style.flex = `${e.layoutConfig?.weight}`
}
e.view.style.marginTop = toPixelString(e.layoutConfig?.margin?.top || 0)
const bottomMargin = e.layoutConfig?.margin?.bottom || 0
e.view.style.marginBottom = toPixelString(
(idx === this.childNodes.length - 1) ? 0 : this.space
+ (e.layoutConfig?.margin?.bottom || 0))
(idx === this.childNodes.length - 1) ? bottomMargin: this.space + bottomMargin)
e.view.style.marginLeft = toPixelString(e.layoutConfig?.margin?.left || 0)
e.view.style.marginRight = toPixelString(e.layoutConfig?.margin?.right || 0)
if ((e.layoutConfig.alignment & LEFT) === LEFT) {