Skip to content

Commit

Permalink
Update the position of the input if the size changes. (cocos#16634)
Browse files Browse the repository at this point in the history
Co-authored-by: qiuguohua <[email protected]>
  • Loading branch information
qiuguohua and qiuguohua authored Dec 22, 2023
1 parent 9599aa9 commit be3507c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cocos/ui/editbox/edit-box-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { BitmapFont } from '../../2d/assets';
import { director } from '../../game/director';
import { game } from '../../game';
import { Mat4, Vec3, visibleRect, sys } from '../../core';
import { view } from '../view';
import { view, View } from '../view';
import { KeyCode } from '../../input/types';
import { contains } from '../../core/utils/misc';
import { Label } from '../../2d/components/label';
Expand Down Expand Up @@ -120,6 +120,7 @@ export class EditBoxImpl extends EditBoxImplBase {
this._initStyleSheet();
this._registerEventListeners();
this._addDomToGameContainer();
View.instance.on('canvas-resize', this._resize, this);
}

public clear (): void {
Expand All @@ -136,6 +137,10 @@ export class EditBoxImpl extends EditBoxImplBase {
this._delegate = null;
}

private _resize (): void {
this._delegate!.node.hasChangedFlags = 1;
}

public update (): void {
const node = this._delegate!.node;
if (!node.hasChangedFlags) {
Expand Down

0 comments on commit be3507c

Please sign in to comment.