Skip to content

Commit

Permalink
update code
Browse files Browse the repository at this point in the history
  • Loading branch information
moshuying committed Jul 26, 2023
1 parent 1cfcc1b commit d047fe9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cocos/2d/framework/canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import { NodeEventType } from '../../scene-graph/node-event';
import { align } from 'cocos/ui/widget-manager';

const _worldPos = new Vec3();
const _widget = new Widget()

const RenderMode = Enum({
OVERLAY: 0,
Expand Down Expand Up @@ -136,6 +135,7 @@ export class Canvas extends RenderRoot2D {
if (EDITOR) {
this.fitDesignResolution_EDITOR = (): void => {
if(!this.node.getComponent('cc.Widget')){
const _widget = new Widget()
// set alignFlags to align this node and uiTransform component
_widget.alignFlags = AlignFlags.TOP | AlignFlags.BOT | AlignFlags.LEFT | AlignFlags.CENTER | AlignFlags.RIGHT;
_widget.target = this.node.parent
Expand Down

0 comments on commit d047fe9

Please sign in to comment.