diff --git a/docs/src/testure2.ts b/docs/src/testure2.ts index ef62192..860fede 100644 --- a/docs/src/testure2.ts +++ b/docs/src/testure2.ts @@ -2,8 +2,8 @@ import { fonts } from 'modern-font' import { Animation, Engine, - FlexboxLayout, FlexElement2D, + FlexLayout, Timeline, } from '../../src' @@ -16,7 +16,7 @@ const engine = new Engine({ document.body.append(engine.view!) async function init(): Promise { - await FlexboxLayout.load() + await FlexLayout.load() fonts.fallbackFont = await fonts.load({ family: 'fallbackFont', src: '/fonts/AaHouDiHei.woff' }) diff --git a/src/scene/2d/FlexElement2D.ts b/src/scene/2d/FlexElement2D.ts index 480f4ce..927c19a 100644 --- a/src/scene/2d/FlexElement2D.ts +++ b/src/scene/2d/FlexElement2D.ts @@ -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 @@ -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 diff --git a/src/scene/2d/FlexboxLayout.ts b/src/scene/2d/FlexLayout.ts similarity index 98% rename from src/scene/2d/FlexboxLayout.ts rename to src/scene/2d/FlexLayout.ts index 3b8f2fc..6aacceb 100644 --- a/src/scene/2d/FlexboxLayout.ts +++ b/src/scene/2d/FlexLayout.ts @@ -91,13 +91,13 @@ export interface ComputedLayout { height: number } -export class FlexboxLayout { +export class FlexLayout { static _yoga?: any static async load(): Promise { this._yoga = await loadYoga() } - _node: YogaNode = FlexboxLayout._yoga!.Node.create() + _node: YogaNode = FlexLayout._yoga!.Node.create() protected get _style(): FlexElement2DStyle { return this._element.style diff --git a/src/scene/2d/index.ts b/src/scene/2d/index.ts index 17433d4..cfc8c4d 100644 --- a/src/scene/2d/index.ts +++ b/src/scene/2d/index.ts @@ -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'