Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hit test implement #24

Merged
merged 12 commits into from
Nov 17, 2022
Merged

Conversation

Zhmz
Copy link

@Zhmz Zhmz commented Nov 12, 2022

Re:

Changes:

  • hittest implement
  • hittest unit tests

@github-actions
Copy link

github-actions bot commented Nov 12, 2022

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -2910,8 +2910,9 @@
          * 1. 三维位置属性(Float32)
          * 2. RGBA 颜色属性(Float32)
          */
         export const vfmtPosColor: gfx.Attribute[];
+        export const vfmtPosColor4B: gfx.Attribute[];
         /**
          * @en Vertex format with the following layout
          * 1. Vector 3 position attribute (Float32)
          * 2. Vector 2 uv attribute (Float32)
@@ -6683,8 +6684,11 @@
                  * @zh 设置相机的曝光值
                  * @param ev100
                  */
                 protected setExposure(ev100: any): void;
+                addIntermediateModel(model: Model): void;
+                getIntermediateModels(): Model[];
+                cleanIntermediateModels(): void;
             }
             export enum ModelType {
                 DEFAULT = 0,
                 SKINNING = 1,
@@ -11573,8 +11577,9 @@
              * @param v2 Specified point 2.
              * @returns Target rectangle.
              */
             static fromMinMax<Out extends IRectLike, VecLike extends IVec2Like>(out: Out, v1: VecLike, v2: VecLike): Out;
+            static fromCenterSize<Out extends IRectLike>(out: Out, center: Vec2, size: Size): Out;
             /**
              * @en Calculate the interpolation result between this rect and another one with given ratio
              * @zh 根据指定的插值比率,从当前矩形到目标矩形之间做插值。
              * @param out Output rect.
@@ -12119,9 +12124,9 @@
          * @param b The second number to test.
          * @param maxDiff Maximum difference.
          * @return True if the numbers are approximately equal, false otherwise.
          */
-        export function approx(a: number, b: number, maxDiff: number): boolean;
+        export function approx(a: number, b: number, maxDiff?: number): boolean;
         /**
          * @en Clamps a value between a minimum float and maximum float value.<br/>
          * @zh 返回最小浮点数和最大浮点数之间的一个数值。可以使用 clamp 函数将不断变化的数值限制在范围内。
          * @param val
@@ -38439,8 +38444,296 @@
         static polygonCircle: typeof __private._cocos_physics_2d_builtin_intersection_2d__polygonCircle;
         static pointInPolygon: typeof __private._cocos_physics_2d_builtin_intersection_2d__pointInPolygon;
         static pointLineDistance: typeof __private._cocos_physics_2d_builtin_intersection_2d__pointLineDistance;
     }
+    export class UISystem extends System {
+        get hudCamera(): renderer.scene.Camera;
+        static get instance(): UISystem;
+        get documents(): ReadonlyArray<UIDocument>;
+        get eventSystem(): __private._cocos_new_ui_event_system_event_system__EventSystem;
+        init(): void;
+        addDocument(document: UIDocument): void;
+        removeDocument(document: UIDocument): void;
+        tick(): void;
+    }
+    export class Anchors extends ValueType {
+        static ZERO: Readonly<Anchors>;
+        get min(): Readonly<math.Vec2>;
+        set min(val: Readonly<math.Vec2>);
+        get max(): Readonly<math.Vec2>;
+        set max(val: Readonly<math.Vec2>);
+        constructor();
+        constructor(horizontal: number, vertical: number);
+        constructor(minX: number, minY: number, maxX: number, maxY: number);
+        clone(): Anchors;
+        set(other: Anchors): void;
+        equals(other: Anchors): boolean;
+    }
+    export class ContainerElement extends UIElement {
+        get children(): ReadonlyArray<UIElement>;
+        get childCount(): number;
+        clearChildren(): void;
+        getChildIndex(child: UIElement): number;
+        getChildAt(index: number): UIElement;
+        addChild(child: UIElement): void;
+        removeChild(child: UIElement): void;
+        removeChildAt(index: number): void;
+        allowMultipleChild(): boolean;
+        protected getLayoutClass(): typeof UILayout;
+        onChildAdded(child: UIElement): void;
+        onChildRemoved(oldChild: UIElement): void;
+    }
+    export class UIRuntimeDocumentSettings extends UIDocumentSettings {
+        get renderMode(): RenderMode;
+        set renderMode(val: RenderMode);
+        get camera(): Camera | null;
+        set camera(val: Camera | null);
+        get width(): number;
+        set width(val: number);
+        get height(): number;
+        set height(val: number);
+        get planeDistance(): number;
+        set planeDistance(val: number);
+    }
+    export class Thickness extends ValueType {
+        static ZERO: Readonly<Thickness>;
+        get left(): number;
+        set left(val: number);
+        get right(): number;
+        set right(val: number);
+        get top(): number;
+        set top(val: number);
+        get bottom(): number;
+        set bottom(val: number);
+        get width(): number;
+        get height(): number;
+        constructor();
+        constructor(uniformLength: number);
+        constructor(left: number, top: number, right: number, bottom: number);
+        set(other: Thickness): void;
+        clone(): Thickness;
+        equals(other: Thickness): boolean;
+    }
+    export class UIBehavior extends __private._cocos_new_ui_base_attached_object__AttachedObject {
+        get element(): UIElement;
+        static produce<T extends UIBehavior>(type: __private._cocos_new_ui_base_ui_behavior__UIBehaviorType<T>, owner: UIElement): T;
+        constructor(element: UIElement);
+    }
+    export class UIDocument {
+        get viewport(): Readonly<math.Rect>;
+        get origin(): Readonly<math.Mat4>;
+        get settings(): UIDocumentSettings;
+        set settings(val: UIDocumentSettings);
+        get window(): UIWindow;
+        invalidate(element: UIElement, invalidateReason: __private._cocos_new_ui_base_ui_element__InvalidateReason): void;
+        removeInvalidation(element: UIElement, invalidateReason: __private._cocos_new_ui_base_ui_element__InvalidateReason): void;
+        update(): void;
+        onElementMounted(element: UIElement): void;
+        onElementUnmounted(element: UIElement): void;
+        getSubSystem<T extends __private._cocos_new_ui_base_ui_subsystem__UISubSystem>(type: __private._types_globals__Constructor<T>): T | null;
+        static getAllRegisterSubsystems(): ReadonlyArray<__private._cocos_new_ui_base_ui_document__UISubSystemType<__private._cocos_new_ui_base_ui_subsystem__UISubSystem>>;
+        static registerSubsystem(type: __private._cocos_new_ui_base_ui_document__UISubSystemType<__private._cocos_new_ui_base_ui_subsystem__UISubSystem>, stage: __private._cocos_new_ui_base_ui_document__UISubSystemStage): void;
+        constructor();
+    }
+    export class UIDocumentSettings {
+        static registerSettingsFactory(factory: __private._cocos_new_ui_base_ui_document_settings__UIDocumentSettingsFactory): void;
+        static produceDefaultSettings(): UIDocumentSettings;
+    }
+    export class UIElement extends __private._cocos_new_ui_base_visual__Visual {
+        static FlowDirectionProperty: __private._cocos_new_ui_base_advanced_property__AdvancedProperty;
+        static OpacityProperty: __private._cocos_new_ui_base_advanced_property__AdvancedProperty;
+        static VisibilityProperty: __private._cocos_new_ui_base_advanced_property__AdvancedProperty;
+        static ClipToBoundsProperty: __private._cocos_new_ui_base_advanced_property__AdvancedProperty;
+        protected _behaviors: Array<UIBehavior>;
+        protected _document: UIDocument | null;
+        protected _parent: ContainerElement | null;
+        protected _children: Array<UIElement>;
+        protected _eventListeners: Array<__private._cocos_new_ui_base_ui_event__IUIEventCallback<UIEvent>>;
+        protected _layoutRect: math.Rect;
+        protected _previousArrangeRect: math.Rect;
+        protected _desiredSize: math.Size;
+        protected _worldTransform: math.Mat4;
+        protected _worldTransformDirty: boolean;
+        protected _paintingDirty: boolean;
+        protected _measureDirty: boolean;
+        protected _arrangeDirty: boolean;
+        protected _hierarchyLevel: number;
+        protected _renderTransform: __private._cocos_new_ui_base_render_transform__RenderTransform;
+        protected _layout: UILayout | null;
+        get layout(): UILayout | null;
+        get renderTransform(): __private._cocos_new_ui_base_render_transform__RenderTransform;
+        get parent(): ContainerElement | null;
+        get document(): UIDocument | null;
+        get hierarchyLevel(): number;
+        get isMeasureDirty(): boolean;
+        get isArrangeDirty(): boolean;
+        get previousArrangeRect(): math.Rect;
+        get layoutRect(): Readonly<math.Rect>;
+        protected set layoutRect(val: Readonly<math.Rect>);
+        get desiredSize(): Readonly<math.Size>;
+        get flowDirection(): __private._cocos_new_ui_base_ui_element__FlowDirection;
+        set flowDirection(flowDirection: __private._cocos_new_ui_base_ui_element__FlowDirection);
+        get opacity(): number;
+        set opacity(val: number);
+        get visibility(): __private._cocos_new_ui_base_ui_element__Visibility;
+        set visibility(val: __private._cocos_new_ui_base_ui_element__Visibility);
+        get clipToBounds(): boolean;
+        set clipToBounds(val: boolean);
+        get worldTransform(): Readonly<math.Mat4>;
+        protected calculateWorldTransform(): void;
+        updateWorldTransform(): void;
+        worldToLocal(out: math.Vec3, worldPoint: math.Vec3): math.Vec3;
+        localToWorld(out: math.Vec3, localPoint: math.Vec3): math.Vec3;
+        removeFromParent(): void;
+        setParent(parent: ContainerElement | null): void;
+        protected updateDocument(document: UIDocument | null): void;
+        invalidateWorldTransform(): void;
+        invalidateParentMeasure(): void;
+        invalidateParentArrange(): void;
+        invalidateParentHierarchy(): void;
+        invalidateMeasure(): void;
+        invalidateArrange(): void;
+        invalidatePainting(): void;
+        invalidate(invalidateReason: __private._cocos_new_ui_base_ui_element__InvalidateReason): void;
+        removeInvalidation(invalidateReason: __private._cocos_new_ui_base_ui_element__InvalidateReason): void;
+        getBehavior<T extends UIBehavior>(type: __private._cocos_new_ui_base_ui_behavior__UIBehaviorType<T>): T | null;
+        addBehavior<T extends UIBehavior>(type: __private._cocos_new_ui_base_ui_behavior__UIBehaviorType<T>): T;
+        removeBehavior<T extends UIBehavior>(type: __private._cocos_new_ui_base_ui_behavior__UIBehaviorType<T>): void;
+        protected computeDesiredSize(): math.Size;
+        protected arrangeContent(arrangeSize: math.Size): void;
+        measure(): void;
+        arrange(finalRect: math.Rect): void;
+        protected onPaint(drawingContext: __private._cocos_new_ui_base_ui_drawing_context__IDrawingContext): void;
+        paint(drawingContext: __private._cocos_new_ui_base_ui_drawing_context__IDrawingContext): void;
+        hitTest(ray: geometry.Ray): boolean;
+        addEventListener<TEvent extends UIEvent>(type: __private._cocos_new_ui_base_ui_event__EventType<TEvent>, fn: (event: TEvent) => void, target?: any): void;
+        removeEventListener<TEvent extends UIEvent>(type: __private._cocos_new_ui_base_ui_event__EventType<TEvent>, fn: (event: TEvent) => void, target?: any): void;
+        hasEventListener<TEvent extends UIEvent>(type: __private._cocos_new_ui_base_ui_event__EventType<TEvent>, fn: (event: TEvent) => void, target?: any): boolean;
+        dispatchEvent(event: UIEvent): void;
+    }
+    export class UIEvent {
+        protected _target: UIElement;
+        constructor(target: UIElement);
+        get target(): UIElement;
+    }
+    export class UILayout extends UIBehavior {
+    }
+    export class UIWindow extends ContentControl {
+        constructor(document: UIDocument);
+        get isMeasureDirty(): boolean;
+        get previousArrangeRect(): Readonly<math.Rect>;
+        setParent(): void;
+        protected calculateWorldTransform(): void;
+    }
+    export class UIBrush {
+        static WHITE: Readonly<UIBrush>;
+        get type(): __private._cocos_new_ui_base_ui_brush__BrushType;
+        set width(val: number);
+        get width(): number;
+        set height(val: number);
+        get height(): number;
+        get tintColor(): Readonly<math.Color>;
+        set tintColor(color: math.Color);
+    }
+    export class UIButton extends __private._cocos_new_ui_base_ui_component__UIComponent {
+        protected _uiElement: UIElement;
+    }
+    export enum InputModulePriority {
+        GLOBAL = 0,
+        UI = 1
+    }
+    export abstract class BaseInputModule {
+        abstract priority: InputModulePriority;
+        protected cacheRaycastResults: __private._cocos_new_ui_event_system_raycast_result__RaycastResult[];
+        constructor();
+    }
+    export class PointerInputModule extends BaseInputModule {
+        priority: InputModulePriority;
+        get mouseInput(): __private._pal_input_web_mouse_input__MouseInputSource;
+        get ray(): geometry.Ray | null;
+        set ray(val: geometry.Ray | null);
+        get eventTouchList(): EventTouch[];
+        get eventMouseList(): EventMouse[];
+        constructor(eventSystem: __private._cocos_new_ui_event_system_event_system__EventSystem);
+        protected _dispatchOrPushEvent(event: Event, eventList: Event[]): void;
+        protected _dispatchEvent(event: Event, ray: geometry.Ray): void;
+        protected clearEvents(): void;
+    }
+    export class Border extends ContentControl {
+        static BorderWidthProperty: __private._cocos_new_ui_base_advanced_property__AdvancedProperty;
+        get borderWidth(): Thickness;
+        set borderWidth(val: Thickness);
+    }
+    export class Button extends ContentControl {
+        static MOUSE_UP_COUNTER: number;
+        static MOUSE_DOWN_COUNTER: number;
+        constructor();
+        protected _onMouseDown(): void;
+        protected _onMouseUp(): void;
+    }
+    export class CanvasLayout extends UILayout {
+        static AnchorsProperty: __private._cocos_new_ui_base_advanced_property__AdvancedProperty;
+        static OffsetsProperty: __private._cocos_new_ui_base_advanced_property__AdvancedProperty;
+        static PivotProperty: __private._cocos_new_ui_base_advanced_property__AdvancedProperty;
+        get anchors(): Anchors;
+        set anchors(val: Anchors);
+        get offsets(): Thickness;
+        set offsets(val: Thickness);
+        get pivot(): math.Vec2;
+        set pivot(val: math.Vec2);
+    }
+    export enum HorizontalAlignment {
+        LEFT = 0,
+        CENTER = 1,
+        RIGHT = 2,
+        STRETCH = 3
+    }
+    export enum VerticalAlignment {
+        TOP = 0,
+        CENTER = 1,
+        BOTTOM = 2,
+        STRETCH = 3
+    }
+    export class ContentLayout extends UILayout {
+        static HorizontalAlignmentProperty: __private._cocos_new_ui_base_advanced_property__AdvancedProperty;
+        static VerticalAlignmentProperty: __private._cocos_new_ui_base_advanced_property__AdvancedProperty;
+        static MarginProperty: __private._cocos_new_ui_base_advanced_property__AdvancedProperty;
+        get horizontalAlignment(): HorizontalAlignment;
+        set horizontalAlignment(val: HorizontalAlignment);
+        get verticalAlignment(): VerticalAlignment;
+        set verticalAlignment(val: VerticalAlignment);
+        get margin(): Thickness;
+        set margin(val: Thickness);
+    }
+    export class ContentControl extends ContainerElement {
+        get content(): UIElement | null;
+        set content(element: UIElement | null);
+        addChild(element: UIElement): void;
+        allowMultipleChild(): boolean;
+        protected getLayoutClass(): typeof UILayout;
+        protected computeDesiredSize(): math.Size;
+        protected arrangeContent(arrangeSize: math.Size): void;
+    }
+    export class Image extends UIElement {
+        static SourceProperty: __private._cocos_new_ui_base_advanced_property__AdvancedProperty;
+        static TintColorProperty: __private._cocos_new_ui_base_advanced_property__AdvancedProperty;
+        get source(): Readonly<UIBrush>;
+        set source(val: Readonly<UIBrush>);
+        get tintColor(): Readonly<math.Color>;
+        set tintColor(val: Readonly<math.Color>);
+        protected computeDesiredSize(): math.Size;
+        protected onPaint(drawingContext: __private._cocos_new_ui_base_ui_drawing_context__IDrawingContext): void;
+    }
+    export class Panel extends ContainerElement {
+        insertChildAt(child: UIElement, index: number): void;
+        changeChildOrder(child: UIElement, index: number): void;
+        allowMultipleChild(): boolean;
+    }
+    export enum RenderMode {
+        OVERLAY = 0,
+        CAMERA = 1,
+        WORLD_SPACE = 2
+    }
     /**
      * @en Particle System base class.
      * cocos2d also supports particles generated by Particle Designer (http://particledesigner.71squared.com/).
      * 'Radius Mode' in Particle Designer uses a fixed emit rate of 30 hz. Since that can't be guarateed in cocos2d,
@@ -46767,262 +47060,8 @@
         onComplete?: (target?: object) => void;
     }
     /**
      * @en
-     * Button component. Can be pressed or clicked. Button has 4 Transition types:
-     *
-     *   - Button.Transition.NONE   // Button will do nothing
-     *   - Button.Transition.COLOR  // Button will change target's color
-     *   - Button.Transition.SPRITE // Button will change target Sprite's sprite
-     *   - Button.Transition.SCALE  // Button will change target node's scale
-     *
-     * The button can bind events (but you must be on the button's node to bind events).<br/>
-     * The following events can be triggered on all platforms.
-     *
-     *  - cc.Node.EventType.TOUCH_START  // Press
-     *  - cc.Node.EventType.TOUCH_MOVE   // After pressing and moving
-     *  - cc.Node.EventType.TOUCH_END    // After pressing and releasing
-     *  - cc.Node.EventType.TOUCH_CANCEL // Press to cancel
-     *
-     * The following events are only triggered on the PC platform:
-     *
-     *   - cc.Node.EventType.MOUSE_DOWN
-     *   - cc.Node.EventType.MOUSE_MOVE
-     *   - cc.Node.EventType.MOUSE_ENTER
-     *   - cc.Node.EventType.MOUSE_LEAVE
-     *   - cc.Node.EventType.MOUSE_UP
-     *
-     * The developer can get the current clicked node with `event.target` from event object which is passed as parameter in the callback function of click event.
-     *
-     * @zh
-     * 按钮组件。可以被按下,或者点击。<br>
-     * 按钮可以通过修改 Transition 来设置按钮状态过渡的方式:
-     *
-     *   - Button.Transition.NONE   // 不做任何过渡
-     *   - Button.Transition.COLOR  // 进行颜色之间过渡
-     *   - Button.Transition.SPRITE // 进行精灵之间过渡
-     *   - Button.Transition.SCALE // 进行缩放过渡
-     *
-     * 按钮可以绑定事件(但是必须要在按钮的 Node 上才能绑定事件)。<br/>
-     * 以下事件可以在全平台上都触发:
-     *
-     *   - cc.Node.EventType.TOUCH_START  // 按下时事件
-     *   - cc.Node.EventType.TOUCH_Move   // 按住移动后事件
-     *   - cc.Node.EventType.TOUCH_END    // 按下后松开后事件
-     *   - cc.Node.EventType.TOUCH_CANCEL // 按下取消事件
-     *
-     * 以下事件只在 PC 平台上触发:
-     *
-     *   - cc.Node.EventType.MOUSE_DOWN  // 鼠标按下时事件
-     *   - cc.Node.EventType.MOUSE_MOVE  // 鼠标按住移动后事件
-     *   - cc.Node.EventType.MOUSE_ENTER // 鼠标进入目标事件
-     *   - cc.Node.EventType.MOUSE_LEAVE // 鼠标离开目标事件
-     *   - cc.Node.EventType.MOUSE_UP    // 鼠标松开事件
-     *
-     * 开发者可以通过获取 **点击事件** 回调函数的参数 event 的 target 属性获取当前点击对象。
-     *
-     * @example
-     * ```ts
-     * import { log, Node } from 'cc';
-     * // Add an event to the button.
-     * button.node.on(Node.EventType.TOUCH_START, (event) => {
-     *     log("This is a callback after the trigger event");
-     * });
-     * // You could also add a click event
-     * // Note: In this way, you can't get the touch event info, so use it wisely.
-     * button.node.on(Node.EventType.CLICK, (button) => {
-     *    //The event is a custom event, you could get the Button component via first argument
-     * })
-     * ```
-     */
-    export class Button extends Component {
-        /**
-         * @en
-         * Transition target.<br/>
-         * When Button state changed:
-         * - Button.Transition.NONE   // Button will do nothing
-         * - Button.Transition.COLOR  // Button will change target's color
-         * - Button.Transition.SPRITE // Button will change target Sprite's sprite
-         * - Button.Transition.SCALE  // Button will change target node's scale
-         *
-         * @zh
-         * 需要过渡的目标。<br/>
-         * 按钮可以通过修改 Transition 来设置按钮状态过渡的方式:
-         * - Button.Transition.NONE   // 不做任何过渡
-         * - Button.Transition.COLOR  // 进行颜色之间过渡
-         * - Button.Transition.SPRITE // 进行 Sprite 之间的过渡
-         * - Button.Transition.SCALE // 进行缩放过渡
-         */
-        get target(): Node;
-        set target(value: Node);
-        /**
-         * @en
-         * Whether the Button is disabled.
-         * If true, the Button will trigger event and do transition.
-         *
-         * @zh
-         * 按钮事件是否被响应,如果为 false,则按钮将被禁用。
-         */
-        get interactable(): boolean;
-        set interactable(value: boolean);
-        set _resizeToTarget(value: boolean);
-        /**
-         * @en
-         * Transition type.
-         *
-         * @zh
-         * 按钮状态改变时过渡方式。
-         */
-        get transition(): __private._cocos_ui_button__Transition;
-        set transition(value: __private._cocos_ui_button__Transition);
-        /**
-         * @en
-         * Normal state color.
-         *
-         * @zh
-         * 普通状态下按钮所显示的颜色。
-         */
-        get normalColor(): Readonly<math.Color>;
-        set normalColor(value: Readonly<math.Color>);
-        /**
-         * @en
-         * Pressed state color.
-         *
-         * @zh
-         * 按下状态时按钮所显示的颜色。
-         */
-        get pressedColor(): Readonly<math.Color>;
-        set pressedColor(value: Readonly<math.Color>);
-        /**
-         * @en
-         * Hover state color.
-         *
-         * @zh
-         * 悬停状态下按钮所显示的颜色。
-         */
-        get hoverColor(): Readonly<math.Color>;
-        set hoverColor(value: Readonly<math.Color>);
-        /**
-         * @en
-         * Disabled state color.
-         *
-         * @zh
-         * 禁用状态下按钮所显示的颜色。
-         */
-        get disabledColor(): Readonly<math.Color>;
-        set disabledColor(value: Readonly<math.Color>);
-        /**
-         * @en
-         * Color and Scale transition duration.
-         *
-         * @zh
-         * 颜色过渡和缩放过渡时所需时间。
-         */
-        get duration(): number;
-        set duration(value: number);
-        /**
-         * @en
-         * When user press the button, the button will zoom to a scale.
-         * The final scale of the button equals (button original scale * zoomScale)
-         * NOTE: Setting zoomScale less than 1 is not adviced, which could fire the touchCancel event if the touch point is out of touch area after scaling.
-         * if you need to do so, you should set target as another background node instead of the button node.
-         *
-         * @zh
-         * 当用户点击按钮后,按钮会缩放到一个值,这个值等于 Button 原始 scale * zoomScale。
-         * 注意:不建议 zoomScale 的值小于 1, 否则缩放后如果触摸点在触摸区域外, 则会触发 touchCancel 事件。
-         * 如果你需要这么做,你应该把 target 设置为另一个背景节点,而不是按钮节点。
-         */
-        get zoomScale(): number;
-        set zoomScale(value: number);
-        /**
-         * @en
-         * Normal state sprite.
-         *
-         * @zh
-         * 普通状态下按钮所显示的 Sprite。
-         */
-        get normalSprite(): SpriteFrame | null;
-        set normalSprite(value: SpriteFrame | null);
-        /**
-         * @en
-         * Pressed state sprite.
-         *
-         * @zh
-         * 按下状态时按钮所显示的 Sprite。
-         */
-        get pressedSprite(): SpriteFrame | null;
-        set pressedSprite(value: SpriteFrame | null);
-        /**
-         * @en
-         * Hover state sprite.
-         *
-         * @zh
-         * 悬停状态下按钮所显示的 Sprite。
-         */
-        get hoverSprite(): SpriteFrame | null;
-        set hoverSprite(value: SpriteFrame | null);
-        /**
-         * @en
-         * Disabled state sprite.
-         *
-         * @zh
-         * 禁用状态下按钮所显示的 Sprite。
-         */
-        get disabledSprite(): SpriteFrame | null;
-        set disabledSprite(value: SpriteFrame | null);
-        static Transition: typeof __private._cocos_ui_button__Transition;
-        static EventType: typeof __private._cocos_ui_button__EventType;
-        /**
-         * @en
-         * If Button is clicked, it will trigger event's handler.
-         *
-         * @zh
-         * 按钮的点击事件列表。
-         */
-        clickEvents: EventHandler[];
-        protected _interactable: boolean;
-        protected _transition: __private._cocos_ui_button__Transition;
-        protected _normalColor: math.Color;
-        protected _hoverColor: math.Color;
-        protected _pressedColor: math.Color;
-        protected _disabledColor: math.Color;
-        protected _normalSprite: SpriteFrame | null;
-        protected _hoverSprite: SpriteFrame | null;
-        protected _pressedSprite: SpriteFrame | null;
-        protected _disabledSprite: SpriteFrame | null;
-        protected _duration: number;
-        protected _zoomScale: number;
-        protected _target: Node | null;
-        __preload(): void;
-        onEnable(): void;
-        onDisable(): void;
-        onDestroy(): void;
-        update(dt: number): void;
-        protected _resizeNodeToTargetNode(): void;
-        protected _resetState(): void;
-        protected _registerNodeEvent(): void;
-        protected _registerTargetEvent(target: any): void;
-        protected _unregisterNodeEvent(): void;
-        protected _unregisterTargetEvent(target: any): void;
-        protected _getTargetSprite(target: Node | null): Sprite | null;
-        protected _applyTarget(): void;
-        protected _onTouchBegan(event?: EventTouch): void;
-        protected _onTouchMove(event?: EventTouch): void;
-        protected _onTouchEnded(event?: EventTouch): void;
-        protected _onTouchCancel(event?: EventTouch): void;
-        protected _onMouseMoveIn(event?: EventMouse): void;
-        protected _onMouseMoveOut(event?: EventMouse): void;
-        protected _updateState(): void;
-        protected _getButtonState(): string;
-        protected _updateColorTransition(state: string): void;
-        protected _updateSpriteTransition(state: string): void;
-        protected _updateScaleTransition(state: string): void;
-        protected _zoomUp(): void;
-        protected _zoomBack(): void;
-        protected _applyTransition(state: string): void;
-    }
-    /**
-     * @en
      * `EditBox` is a component for inputing text, you can use it to gather small amounts of text from users.
      *
      * @zh
      * `EditBox` 组件,用于获取用户的输入文本。
@@ -48229,9 +48268,9 @@
      *
      * @zh
      * Toggle 是一个 CheckBox,当它和 ToggleGroup 一起使用的时候,可以变成 RadioButton。
      */
-    export class Toggle extends Button {
+    export class Toggle extends ButtonComponent {
         /**
          * @en
          * When this value is true, the check mark component will be enabled,
          * otherwise the check mark component will be disabled.
@@ -49146,8 +49185,262 @@
         constructor();
     }
     /**
      * @en
+     * Button component. Can be pressed or clicked. Button has 4 Transition types:
+     *
+     *   - Button.Transition.NONE   // Button will do nothing
+     *   - Button.Transition.COLOR  // Button will change target's color
+     *   - Button.Transition.SPRITE // Button will change target Sprite's sprite
+     *   - Button.Transition.SCALE  // Button will change target node's scale
+     *
+     * The button can bind events (but you must be on the button's node to bind events).<br/>
+     * The following events can be triggered on all platforms.
+     *
+     *  - cc.Node.EventType.TOUCH_START  // Press
+     *  - cc.Node.EventType.TOUCH_MOVE   // After pressing and moving
+     *  - cc.Node.EventType.TOUCH_END    // After pressing and releasing
+     *  - cc.Node.EventType.TOUCH_CANCEL // Press to cancel
+     *
+     * The following events are only triggered on the PC platform:
+     *
+     *   - cc.Node.EventType.MOUSE_DOWN
+     *   - cc.Node.EventType.MOUSE_MOVE
+     *   - cc.Node.EventType.MOUSE_ENTER
+     *   - cc.Node.EventType.MOUSE_LEAVE
+     *   - cc.Node.EventType.MOUSE_UP
+     *
+     * The developer can get the current clicked node with `event.target` from event object which is passed as parameter in the callback function of click event.
+     *
+     * @zh
+     * 按钮组件。可以被按下,或者点击。<br>
+     * 按钮可以通过修改 Transition 来设置按钮状态过渡的方式:
+     *
+     *   - Button.Transition.NONE   // 不做任何过渡
+     *   - Button.Transition.COLOR  // 进行颜色之间过渡
+     *   - Button.Transition.SPRITE // 进行精灵之间过渡
+     *   - Button.Transition.SCALE // 进行缩放过渡
+     *
+     * 按钮可以绑定事件(但是必须要在按钮的 Node 上才能绑定事件)。<br/>
+     * 以下事件可以在全平台上都触发:
+     *
+     *   - cc.Node.EventType.TOUCH_START  // 按下时事件
+     *   - cc.Node.EventType.TOUCH_Move   // 按住移动后事件
+     *   - cc.Node.EventType.TOUCH_END    // 按下后松开后事件
+     *   - cc.Node.EventType.TOUCH_CANCEL // 按下取消事件
+     *
+     * 以下事件只在 PC 平台上触发:
+     *
+     *   - cc.Node.EventType.MOUSE_DOWN  // 鼠标按下时事件
+     *   - cc.Node.EventType.MOUSE_MOVE  // 鼠标按住移动后事件
+     *   - cc.Node.EventType.MOUSE_ENTER // 鼠标进入目标事件
+     *   - cc.Node.EventType.MOUSE_LEAVE // 鼠标离开目标事件
+     *   - cc.Node.EventType.MOUSE_UP    // 鼠标松开事件
+     *
+     * 开发者可以通过获取 **点击事件** 回调函数的参数 event 的 target 属性获取当前点击对象。
+     *
+     * @example
+     * ```ts
+     * import { log, Node } from 'cc';
+     * // Add an event to the button.
+     * button.node.on(Node.EventType.TOUCH_START, (event) => {
+     *     log("This is a callback after the trigger event");
+     * });
+     * // You could also add a click event
+     * // Note: In this way, you can't get the touch event info, so use it wisely.
+     * button.node.on(Node.EventType.CLICK, (button) => {
+     *    //The event is a custom event, you could get the Button component via first argument
+     * })
+     * ```
+     */
+    export class ButtonComponent extends Component {
+        /**
+         * @en
+         * Transition target.<br/>
+         * When Button state changed:
+         * - Button.Transition.NONE   // Button will do nothing
+         * - Button.Transition.COLOR  // Button will change target's color
+         * - Button.Transition.SPRITE // Button will change target Sprite's sprite
+         * - Button.Transition.SCALE  // Button will change target node's scale
+         *
+         * @zh
+         * 需要过渡的目标。<br/>
+         * 按钮可以通过修改 Transition 来设置按钮状态过渡的方式:
+         * - Button.Transition.NONE   // 不做任何过渡
+         * - Button.Transition.COLOR  // 进行颜色之间过渡
+         * - Button.Transition.SPRITE // 进行 Sprite 之间的过渡
+         * - Button.Transition.SCALE // 进行缩放过渡
+         */
+        get target(): Node;
+        set target(value: Node);
+        /**
+         * @en
+         * Whether the Button is disabled.
+         * If true, the Button will trigger event and do transition.
+         *
+         * @zh
+         * 按钮事件是否被响应,如果为 false,则按钮将被禁用。
+         */
+        get interactable(): boolean;
+        set interactable(value: boolean);
+        set _resizeToTarget(value: boolean);
+        /**
+         * @en
+         * Transition type.
+         *
+         * @zh
+         * 按钮状态改变时过渡方式。
+         */
+        get transition(): __private._cocos_ui_button__Transition;
+        set transition(value: __private._cocos_ui_button__Transition);
+        /**
+         * @en
+         * Normal state color.
+         *
+         * @zh
+         * 普通状态下按钮所显示的颜色。
+         */
+        get normalColor(): Readonly<math.Color>;
+        set normalColor(value: Readonly<math.Color>);
+        /**
+         * @en
+         * Pressed state color.
+         *
+         * @zh
+         * 按下状态时按钮所显示的颜色。
+         */
+        get pressedColor(): Readonly<math.Color>;
+        set pressedColor(value: Readonly<math.Color>);
+        /**
+         * @en
+         * Hover state color.
+         *
+         * @zh
+         * 悬停状态下按钮所显示的颜色。
+         */
+        get hoverColor(): Readonly<math.Color>;
+        set hoverColor(value: Readonly<math.Color>);
+        /**
+         * @en
+         * Disabled state color.
+         *
+         * @zh
+         * 禁用状态下按钮所显示的颜色。
+         */
+        get disabledColor(): Readonly<math.Color>;
+        set disabledColor(value: Readonly<math.Color>);
+        /**
+         * @en
+         * Color and Scale transition duration.
+         *
+         * @zh
+         * 颜色过渡和缩放过渡时所需时间。
+         */
+        get duration(): number;
+        set duration(value: number);
+        /**
+         * @en
+         * When user press the button, the button will zoom to a scale.
+         * The final scale of the button equals (button original scale * zoomScale)
+         * NOTE: Setting zoomScale less than 1 is not adviced, which could fire the touchCancel event if the touch point is out of touch area after scaling.
+         * if you need to do so, you should set target as another background node instead of the button node.
+         *
+         * @zh
+         * 当用户点击按钮后,按钮会缩放到一个值,这个值等于 Button 原始 scale * zoomScale。
+         * 注意:不建议 zoomScale 的值小于 1, 否则缩放后如果触摸点在触摸区域外, 则会触发 touchCancel 事件。
+         * 如果你需要这么做,你应该把 target 设置为另一个背景节点,而不是按钮节点。
+         */
+        get zoomScale(): number;
+        set zoomScale(value: number);
+        /**
+         * @en
+         * Normal state sprite.
+         *
+         * @zh
+         * 普通状态下按钮所显示的 Sprite。
+         */
+        get normalSprite(): SpriteFrame | null;
+        set normalSprite(value: SpriteFrame | null);
+        /**
+         * @en
+         * Pressed state sprite.
+         *
+         * @zh
+         * 按下状态时按钮所显示的 Sprite。
+         */
+        get pressedSprite(): SpriteFrame | null;
+        set pressedSprite(value: SpriteFrame | null);
+        /**
+         * @en
+         * Hover state sprite.
+         *
+         * @zh
+         * 悬停状态下按钮所显示的 Sprite。
+         */
+        get hoverSprite(): SpriteFrame | null;
+        set hoverSprite(value: SpriteFrame | null);
+        /**
+         * @en
+         * Disabled state sprite.
+         *
+         * @zh
+         * 禁用状态下按钮所显示的 Sprite。
+         */
+        get disabledSprite(): SpriteFrame | null;
+        set disabledSprite(value: SpriteFrame | null);
+        static Transition: typeof __private._cocos_ui_button__Transition;
+        static EventType: typeof __private._cocos_ui_button__EventType;
+        /**
+         * @en
+         * If Button is clicked, it will trigger event's handler.
+         *
+         * @zh
+         * 按钮的点击事件列表。
+         */
+        clickEvents: EventHandler[];
+        protected _interactable: boolean;
+        protected _transition: __private._cocos_ui_button__Transition;
+        protected _normalColor: math.Color;
+        protected _hoverColor: math.Color;
+        protected _pressedColor: math.Color;
+        protected _disabledColor: math.Color;
+        protected _normalSprite: SpriteFrame | null;
+        protected _hoverSprite: SpriteFrame | null;
+        protected _pressedSprite: SpriteFrame | null;
+        protected _disabledSprite: SpriteFrame | null;
+        protected _duration: number;
+        protected _zoomScale: number;
+        protected _target: Node | null;
+        __preload(): void;
+        onEnable(): void;
+        onDisable(): void;
+        onDestroy(): void;
+        update(dt: number): void;
+        protected _resizeNodeToTargetNode(): void;
+        protected _resetState(): void;
+        protected _registerNodeEvent(): void;
+        protected _registerTargetEvent(target: any): void;
+        protected _unregisterNodeEvent(): void;
+        protected _unregisterTargetEvent(target: any): void;
+        protected _getTargetSprite(target: Node | null): Sprite | null;
+        protected _applyTarget(): void;
+        protected _onTouchBegan(event?: EventTouch): void;
+        protected _onTouchMove(event?: EventTouch): void;
+        protected _onTouchEnded(event?: EventTouch): void;
+        protected _onTouchCancel(event?: EventTouch): void;
+        protected _onMouseMoveIn(event?: EventMouse): void;
+        protected _onMouseMoveOut(event?: EventMouse): void;
+        protected _updateState(): void;
+        protected _getButtonState(): string;
+        protected _updateColorTransition(state: string): void;
+        protected _updateSpriteTransition(state: string): void;
+        protected _updateScaleTransition(state: string): void;
+        protected _zoomUp(): void;
+        protected _zoomBack(): void;
+        protected _applyTransition(state: string): void;
+    }
+    /**
+     * @en
      * The video clip asset.
      * @zh
      * 视频片段资源。
      */
@@ -57037,8 +57330,194 @@
          * @en Calculate the distance of point to line.
          * @zh 计算点到直线的距离。如果这是一条线段并且垂足不在线段内,则会计算点到线段端点的距离。
          */
         function _cocos_physics_2d_builtin_intersection_2d__pointLineDistance(point: Readonly<math.Vec2>, start: Readonly<math.Vec2>, end: Readonly<math.Vec2>, isSegment: boolean): number;
+        export enum _cocos_new_ui_event_system_event_data_mouse_button_event__InputMouseButton {
+            LEFT = 0,
+            RIGHT = 1,
+            MIDDLE = 2
+        }
+        export enum _cocos_new_ui_event_system_event_data_mouse_button_event__FramePressState {
+            PRESSED = 0,
+            RELEASED = 1,
+            PRESSED_AND_RELEASED = 2,
+            NOT_CHANGED = 3
+        }
+        export class _cocos_new_ui_event_system_event_data_mouse_button_event__MouseButtonEvent {
+            protected _mouseButton: _cocos_new_ui_event_system_event_data_mouse_button_event__InputMouseButton;
+            protected _pressState: _cocos_new_ui_event_system_event_data_mouse_button_event__FramePressState;
+            protected _event: Event | null;
+            protected _ray: geometry.Ray | null;
+            constructor(mouseButton: _cocos_new_ui_event_system_event_data_mouse_button_event__InputMouseButton);
+            get mouseButton(): _cocos_new_ui_event_system_event_data_mouse_button_event__InputMouseButton;
+            set mouseButton(val: _cocos_new_ui_event_system_event_data_mouse_button_event__InputMouseButton);
+            get pressState(): _cocos_new_ui_event_system_event_data_mouse_button_event__FramePressState;
+            set pressState(val: _cocos_new_ui_event_system_event_data_mouse_button_event__FramePressState);
+            get event(): Event | null;
+            set event(val: Event | null);
+            get ray(): geometry.Ray | null;
+            set ray(val: geometry.Ray | null);
+            pressedThisFrame(): boolean;
+            releasedThisFrame(): boolean;
+        }
+        export class _cocos_new_ui_event_system_event_system__EventSystem {
+            get inputModule(): BaseInputModule | null;
+            set inputModule(val: BaseInputModule | null);
+            constructor(uiSystem: UISystem);
+            tick(): void;
+            protected emitEvent(event: Event): void;
+            registerInputModule(inputModule: BaseInputModule): void;
+            handleTouchEvent(event: Event, ray: geometry.Ray): void;
+            dispatchTouchEvent(): void;
+            handleMouseEvent(event: Event, ray: geometry.Ray): void;
+            dispatchMouseEvent(mouseButtonEvent: _cocos_new_ui_event_system_event_data_mouse_button_event__MouseButtonEvent): void;
+        }
+        export type _cocos_new_ui_base_ui_behavior__UIBehaviorType<T extends UIBehavior> = new (element: UIElement) => T;
+        export type _cocos_new_ui_base_advanced_property__Constructor<T = any> = new (...args: any[]) => T;
+        export enum _cocos_new_ui_base_advanced_property__Primitive {
+            NUMBER = 0,
+            STRING = 1,
+            BOOLEAN = 2
+        }
+        export class _cocos_new_ui_base_advanced_property__AdvancedProperty {
+            static UNSET_VALUE: undefined;
+            static register<OT extends _cocos_new_ui_base_advanced_object__AdvancedObject | _cocos_new_ui_base_attached_object__AttachedObject>(name: string, type: _cocos_new_ui_base_advanced_property__Constructor | Record<string, number | string> | _cocos_new_ui_base_advanced_property__Primitive, ownerType: _cocos_new_ui_base_advanced_property__Constructor<OT>, defaultValue?: any): _cocos_new_ui_base_advanced_property__AdvancedProperty;
+            static get allRegisteredProperties(): ReadonlyArray<_cocos_new_ui_base_advanced_property__AdvancedProperty>;
+            static getRegisteredPropertiesForOwnerType<OT extends _cocos_new_ui_base_advanced_object__AdvancedObject | _cocos_new_ui_base_attached_object__AttachedObject>(ownerType: _cocos_new_ui_base_advanced_property__Constructor<OT>): _cocos_new_ui_base_advanced_property__AdvancedProperty[];
+            get name(): string;
+            get propertyType(): _cocos_new_ui_base_advanced_property__Constructor<any> | Record<string, string | number> | _cocos_new_ui_base_advanced_property__Primitive;
+            get ownerType(): _cocos_new_ui_base_advanced_property__Constructor<_cocos_new_ui_base_attached_object__AttachedObject | _cocos_new_ui_base_advanced_object__AdvancedObject>;
+            get defaultValue(): unknown;
+            get id(): number;
+        }
+        export class _cocos_new_ui_base_advanced_object__AdvancedObject {
+            getValue(property: _cocos_new_ui_base_advanced_property__AdvancedProperty): any;
+            setValue(property: _cocos_new_ui_base_advanced_property__AdvancedProperty, value: any): void;
+            clearValue(property: _cocos_new_ui_base_advanced_property__AdvancedProperty): void;
+        }
+        export class _cocos_new_ui_base_attached_object__AttachedObject {
+            protected _owner: _cocos_new_ui_base_advanced_object__AdvancedObject;
+            get owner(): _cocos_new_ui_base_advanced_object__AdvancedObject;
+            constructor(owner: _cocos_new_ui_base_advanced_object__AdvancedObject);
+            getValue(property: _cocos_new_ui_base_advanced_property__AdvancedProperty): any;
+            setValue(property: _cocos_new_ui_base_advanced_property__AdvancedProperty, value: any): void;
+        }
+        export enum _cocos_new_ui_base_ui_element__InvalidateReason {
+            HIERARCHY = 1,
+            MEASURE = 2,
+            ARRANGE = 4,
+            STYLE = 8,
+            TRANSFORM = 16,
+            PAINT = 32,
+            LAYOUT = 6
+        }
+        export class _cocos_new_ui_base_ui_subsystem__UISubSystem {
+            protected _document: UIDocument;
+            constructor(document: UIDocument);
+            get document(): UIDocument;
+            onElementMounted(element: UIElement): void;
+            onElementUnmounted(element: UIElement): void;
+            invalidate(element: UIElement, invalidateReason: _cocos_new_ui_base_ui_element__InvalidateReason): void;
+            removeInvalidation(element: UIElement, invalidateReason: _cocos_new_ui_base_ui_element__InvalidateReason): void;
+            update(): void;
+        }
+        export type _cocos_new_ui_base_ui_document__UISubSystemType<T extends _cocos_new_ui_base_ui_subsystem__UISubSystem> = new (document: UIDocument) => T;
+        export enum _cocos_new_ui_base_ui_document__UISubSystemStage {
+            EVENT = 0,
+            LAYOUT = 100,
+            TRANSFORM = 200,
+            PAINT = 300
+        }
+        export class _cocos_new_ui_base_ui_document_settings__UIDocumentSettingsFactory {
+            produce(): UIDocumentSettings;
+        }
+        export type _cocos_new_ui_base_ui_event__EventType<T extends UIEvent> = new (...arg: any[]) => T;
+        export interface _cocos_new_ui_base_ui_event__IUIEventCallback<T extends UIEvent> {
+            target: any;
+            callback: (event: any) => void;
+            eventType: _cocos_new_ui_base_ui_event__EventType<T>;
+        }
+        export class _cocos_new_ui_base_render_transform__RenderTransform extends UIBehavior {
+            static PositionProperty: _cocos_new_ui_base_advanced_property__AdvancedProperty;
+            static RotationProperty: _cocos_new_ui_base_advanced_property__AdvancedProperty;
+            static ScaleProperty: _cocos_new_ui_base_advanced_property__AdvancedProperty;
+            static ShearProperty: _cocos_new_ui_base_advanced_property__AdvancedProperty;
+            static PivotProperty: _cocos_new_ui_base_advanced_property__AdvancedProperty;
+            get position(): math.Vec3;
+            set position(val: math.Vec3);
+            get eulerAngles(): math.Vec3;
+            set eulerAngles(val: math.Vec3);
+            get rotation(): math.Quat;
+            set rotation(val: math.Quat);
+            get shear(): math.Vec2;
+            set shear(val: math.Vec2);
+            get scale(): math.Vec3;
+            set scale(val: math.Vec3);
+            get pivot(): math.Vec2;
+            set pivot(val: math.Vec2);
+            get matrix(): math.Mat4;
+        }
+        export enum _cocos_new_ui_base_ui_element__FlowDirection {
+            LEFT_TO_RIGHT = 0,
+            RIGHT_TO_LEFT = 1
+        }
+        export enum _cocos_new_ui_base_ui_element__Visibility {
+            VISIBLE = 0,
+            HIDDEN = 1,
+            COLLAPSED = 2
+        }
+        export abstract class _cocos_new_ui_base_ui_drawing_context__IDrawingContext {
+            abstract get currentElement(): UIElement;
+            abstract drawRect(rect: math.Rect, color: math.Color): any;
+            abstract drawBrush(rect: math.Rect, color: math.Color, brush: Readonly<UIBrush>): any;
+            abstract drawText(rect: math.Rect, color: math.Color, text: string, font: string, fontSize: number): any;
+        }
+        export class _cocos_new_ui_base_visual__UIRenderData {
+            setIsVisible(val: boolean): void;
+            setCascadedOpacity(val: number): void;
+            setWorldMatrix(val: math.Mat4): void;
+            clearChildren(): void;
+            addChild(child: _cocos_new_ui_base_visual__UIRenderData): void;
+            removeChild(child: _cocos_new_ui_base_visual__UIRenderData): void;
+        }
+        export class _cocos_new_ui_base_visual__UIRenderDataFactory {
+            produce(visual: _cocos_new_ui_base_visual__Visual): _cocos_new_ui_base_visual__UIRenderData;
+        }
+        export class _cocos_new_ui_base_visual__Visual extends _cocos_new_ui_base_advanced_object__AdvancedObject {
+            get renderData(): _cocos_new_ui_base_visual__UIRenderData;
+            protected setIsVisible(val: boolean): void;
+            protected setCascadedOpacity(val: number): void;
+            protected setVisualTransform(val: Readonly<math.Mat4>): void;
+            protected removeVisualChild(child: _cocos_new_ui_base_visual__Visual): void;
+            protected addVisualChild(child: _cocos_new_ui_base_visual__Visual): void;
+            protected clearVisualChildren(): void;
+            static registerRenderDataFactory(renderDataFactory: _cocos_new_ui_base_visual__UIRenderDataFactory): void;
+            static allocateRenderData(visual: _cocos_new_ui_base_visual__Visual): _cocos_new_ui_base_visual__UIRenderData;
+        }
+        export enum _cocos_new_ui_base_ui_brush__BrushType {
+            COLOR = 0,
+            TEXTURE = 1,
+            RENDER_TEXTURE = 2,
+            SPRITE_FRAME = 3,
+            MATERIAL = 4,
+            VECTOR_IMAGE = 5
+        }
+        export abstract class _cocos_new_ui_base_ui_component__UIComponent extends Component {
+            protected abstract _uiElement: UIElement;
+            get uiElement(): UIElement;
+            buildUITree(context: any): void;
+        }
+        export class _cocos_new_ui_event_system_raycast_result__RaycastResult {
+        }
+        export type _pal_input__MouseCallback = (res: import('cocos/input/types').EventMouse) => void;
+        export class _pal_input_web_mouse_input__MouseInputSource {
+            constructor();
+            dispatchMouseDownEvent(nativeMouseEvent: any): void;
+            dispatchMouseMoveEvent(nativeMouseEvent: any): void;
+            dispatchMouseUpEvent(nativeMouseEvent: any): void;
+            dispatchScrollEvent(nativeMouseEvent: WheelEvent): void;
+            on(eventType: _cocos_input_types_event_enum__InputEventType, callback: _pal_input__MouseCallback, target?: any): void;
+        }
         export class _cocos_particle_2d_particle_simulator_2d__Particle {
             pos: math.Vec2;
             startPos: math.Vec2;
             color: math.Color;
@@ -59642,51 +60121,8 @@
              */
             repeatForever(): _cocos_tween_actions_action_interval__ActionInterval;
         }
         /**
-         * @en Enum for transition type.
-         *
-         * @zh 过渡类型。
-         */
-        export enum _cocos_ui_button__Transition {
-            /**
-             * @en The none type.
-             *
-             * @zh 不做任何过渡。
-             */
-            NONE = 0,
-            /**
-             * @en The color type.
-             *
-             * @zh 颜色过渡。
-             */
-            COLOR = 1,
-            /**
-             * @en The sprite type.
-             *
-             * @zh 精灵过渡。
-             */
-            SPRITE = 2,
-            /**
-             * @en The scale type.
-             *
-             * @zh 缩放过渡。
-             */
-            SCALE = 3
-        }
-        /**
-         * @en The event types of [[Button]]. All button events are distributed by the owner Node, not the component
-         * @zh [[Button]] 的事件类型,注意:事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。
-         */
-        export enum _cocos_ui_button__EventType {
-            /**
-             * @event click
-             * @param {Event.EventCustom} event
-             * @param {Button} button - The Button component.
-             */
-            CLICK = "click"
-        }
-        /**
          * 定义了一些用于设置文本显示和文本格式化的标志位。
          * @readonly
          * @enum EditBox.InputFlag
          */
@@ -60152,8 +60588,20 @@
         export enum _cocos_ui_toggle__EventType {
             TOGGLE = "toggle"
         }
         /**
+         * @en The event types of [[Button]]. All button events are distributed by the owner Node, not the component
+         * @zh [[Button]] 的事件类型,注意:事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。
+         */
+        export enum _cocos_ui_button__EventType {
+            /**
+             * @event click
+             * @param {Event.EventCustom} event
+             * @param {Button} button - The Button component.
+             */
+            CLICK = "click"
+        }
+        /**
          * @en Enum for Widget's alignment mode, indicating when the widget should refresh.
          *
          * @zh Widget 的对齐模式,表示 Widget 应该何时刷新。
          */
@@ -60301,8 +60749,39 @@
              */
             VERTICAL = 1
         }
         function _cocos_ui_widget_manager__updateAlignment(node: Node): void;
+        /**
+         * @en Enum for transition type.
+         *
+         * @zh 过渡类型。
+         */
+        export enum _cocos_ui_button__Transition {
+            /**
+             * @en The none type.
+             *
+             * @zh 不做任何过渡。
+             */
+            NONE = 0,
+            /**
+             * @en The color type.
+             *
+             * @zh 颜色过渡。
+             */
+            COLOR = 1,
+            /**
+             * @en The sprite type.
+             *
+             * @zh 精灵过渡。
+             */
+            SPRITE = 2,
+            /**
+             * @en The scale type.
+             *
+             * @zh 缩放过渡。
+             */
+            SCALE = 3
+        }
         export enum _cocos_video_video_player_enums__EventType {
             /**
              * @en None
              * @zh 无
@@ -60521,8 +61000,8 @@
     import { exoticAnimationTag, ExoticAnimation } from "cc/editor/exotic-animation";
     import { EmbeddedPlayer, embeddedPlayerCountTag, getEmbeddedPlayersTag, addEmbeddedPlayerTag, removeEmbeddedPlayerTag, clearEmbeddedPlayersTag } from "cc/editor/embedded-player";
     import { AnimationMask } from "cc/editor/new-gen-anim";
     import { CCON } from "cc/editor/serialization";
-    export { Canvas as CanvasComponent, UIRenderer as RenderComponent, UIRenderer as UIRenderable, UIRenderer as Renderable2D, UITransform as UITransformComponent, Mask as MaskComponent, RichText as RichTextComponent, Sprite as SpriteComponent, UIMeshRenderer as UIModelComponent, LabelOutline as LabelOutlineComponent, Graphics as GraphicsComponent, UIStaticBatch as UIStaticBatchComponent, UIOpacity as UIOpacityComponent, Label as LabelComponent, MeshRenderer as ModelComponent, DirectionalLight as DirectionalLightComponent, Light as LightComponent, SphereLight as SphereLightComponent, SpotLight as SpotLightComponent, SkinnedMeshRenderer as SkinningModelComponent, SkinnedMeshBatchRenderer as BatchedSkinningModelComponent, SkinnedMeshUnit as SkinningModelUnit, Animation as AnimationComponent, AudioSource as AudioSourceComponent, Camera as CameraComponent, ModelRenderer as RenderableComponent, Billboard as BillboardComponent, Line as LineComponent, ParticleSystem as ParticleSystemComponent, SkeletalAnimation as SkeletalAnimationComponent, Button as ButtonComponent, EditBox as EditBoxComponent, Layout as LayoutComponent, ProgressBar as ProgressBarComponent, ScrollBar as ScrollBarComponent, ScrollView as ScrollViewComponent, Slider as SliderComponent, Toggle as ToggleComponent, ToggleContainer as ToggleContainerComponent, Widget as WidgetComponent, PageView as PageViewComponent, PageViewIndicator as PageViewIndicatorComponent, SafeArea as SafeAreaComponent, UICoordinateTracker as UICoordinateTrackerComponent, BlockInputEvents as BlockInputEventsComponent } from "cc";
+    export { Canvas as CanvasComponent, UIRenderer as RenderComponent, UIRenderer as UIRenderable, UIRenderer as Renderable2D, UITransform as UITransformComponent, Mask as MaskComponent, RichText as RichTextComponent, Sprite as SpriteComponent, UIMeshRenderer as UIModelComponent, LabelOutline as LabelOutlineComponent, Graphics as GraphicsComponent, UIStaticBatch as UIStaticBatchComponent, UIOpacity as UIOpacityComponent, Label as LabelComponent, MeshRenderer as ModelComponent, DirectionalLight as DirectionalLightComponent, Light as LightComponent, SphereLight as SphereLightComponent, SpotLight as SpotLightComponent, SkinnedMeshRenderer as SkinningModelComponent, SkinnedMeshBatchRenderer as BatchedSkinningModelComponent, SkinnedMeshUnit as SkinningModelUnit, Animation as AnimationComponent, AudioSource as AudioSourceComponent, Camera as CameraComponent, ModelRenderer as RenderableComponent, Billboard as BillboardComponent, Line as LineComponent, ParticleSystem as ParticleSystemComponent, SkeletalAnimation as SkeletalAnimationComponent, EditBox as EditBoxComponent, Layout as LayoutComponent, ProgressBar as ProgressBarComponent, ScrollBar as ScrollBarComponent, ScrollView as ScrollViewComponent, Slider as SliderComponent, Toggle as ToggleComponent, ToggleContainer as ToggleContainerComponent, Widget as WidgetComponent, PageView as PageViewComponent, PageViewIndicator as PageViewIndicatorComponent, SafeArea as SafeAreaComponent, UICoordinateTracker as UICoordinateTrackerComponent, BlockInputEvents as BlockInputEventsComponent } from "cc";
     import { Details as _Details } from "cc";
     export {};
 }

// top right
pointC.set(position.x + width / 2, position.y + height / 2, position.z);

Plane.fromPoints(temp_plane, pointA, pointB, pointC);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不对,没有考虑 ui 的变换

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

@SantyWang SantyWang merged commit b04f0cc into SantyWang:ui-framework Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants