Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

Commit

Permalink
feat: mix box
Browse files Browse the repository at this point in the history
  • Loading branch information
sheepbox8646 committed May 14, 2024
1 parent 707d425 commit bf8a299
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/core/src/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type AnimateFunction<T extends Widget> = (animation: Animation<T>, durati
setAsync: () => ReturnType<AnimateFunction<T>>
setSync: () => ReturnType<AnimateFunction<T>>
}
export type Layout = 'row' | 'column' | 'absolute'
export type Layout = 'row' | 'column' | 'absolute' | 'mix'

export interface WidgetOptions {
style?: WidgetStyle
Expand Down Expand Up @@ -173,6 +173,17 @@ export class Widget {
child.y = child.y + (this.children[index - 1].style.margin as [number, number, number, number])[1] + (child.style.margin as [number, number, number, number])[0]
break
}
case 'mix': {
if (index === 0) {
child.x = child.x + (child.style.margin as [number, number, number, number])[2]
child.y = child.y + (child.style.margin as [number, number, number, number])[0]
}
else {
child.x = child.x + (this.children[index - 1].style.margin as [number, number, number, number])[3] + (child.style.margin as [number, number, number, number])[2]
child.y = child.y + (this.children[index - 1].style.margin as [number, number, number, number])[1] + (child.style.margin as [number, number, number, number])[0]
}
break
}
}
index += 1
}
Expand Down

0 comments on commit bf8a299

Please sign in to comment.