Skip to content

Commit

Permalink
feat: rename FlexboxLayout to FlexLayout
Browse files Browse the repository at this point in the history
  • Loading branch information
qq15725 committed Feb 27, 2025
1 parent 1686edf commit 6fa77f1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/src/testure2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { fonts } from 'modern-font'
import {
Animation,
Engine,
FlexboxLayout,
FlexElement2D,
FlexLayout,
Timeline,
} from '../../src'

Expand All @@ -16,7 +16,7 @@ const engine = new Engine({
document.body.append(engine.view!)

async function init(): Promise<void> {
await FlexboxLayout.load()
await FlexLayout.load()

fonts.fallbackFont = await fonts.load({ family: 'fallbackFont', src: '/fonts/AaHouDiHei.woff' })

Expand Down
4 changes: 2 additions & 2 deletions src/scene/2d/FlexElement2D.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import type { FlexElement2DStyleProperties } from './FlexElement2DStyle'
import { Direction } from 'yoga-layout/load'
import { customNode } from '../../core'
import { BaseElement2D } from './BaseElement2D'
import { FlexboxLayout } from './FlexboxLayout'
import { FlexElement2DStyle } from './FlexElement2DStyle'
import { FlexLayout } from './FlexLayout'

export interface FlexBaseElement2DEventMap extends BaseElement2DEventMap {
updateStyleProperty: (key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration) => void
Expand Down Expand Up @@ -48,7 +48,7 @@ export class FlexElement2D extends BaseElement2D implements Rectangulable {
this._style = style
}

_layout = new FlexboxLayout(this)
_layout = new FlexLayout(this)

get offsetLeft(): number {
return this._layout.offsetLeft
Expand Down
4 changes: 2 additions & 2 deletions src/scene/2d/FlexboxLayout.ts → src/scene/2d/FlexLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ export interface ComputedLayout {
height: number
}

export class FlexboxLayout {
export class FlexLayout {
static _yoga?: any
static async load(): Promise<void> {
this._yoga = await loadYoga()
}

_node: YogaNode = FlexboxLayout._yoga!.Node.create()
_node: YogaNode = FlexLayout._yoga!.Node.create()

protected get _style(): FlexElement2DStyle {
return this._element.style
Expand Down
2 changes: 1 addition & 1 deletion src/scene/2d/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ export * from './BaseElement2D'
export * from './BaseElement2DStyle'
export * from './Element2D'
export * from './Element2DStyle'
export * from './FlexboxLayout'
export * from './FlexElement2D'
export * from './FlexElement2DStyle'
export * from './FlexLayout'
export * from './Graphics2D'
export * from './Image2D'
export * from './Lottie2D'
Expand Down

0 comments on commit 6fa77f1

Please sign in to comment.