Skip to content

Commit

Permalink
Merge pull request #16442 from cocos/v3.8.1
Browse files Browse the repository at this point in the history
Revert "Fix sprite size mode change by preload (#15908)" (#16388)
  • Loading branch information
VisualSJ authored Oct 26, 2023
2 parents e9b7fd3 + c4fcece commit 02f35dd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cocos/2d/components/sprite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { ccclass, help, executionOrder, menu, tooltip, displayOrder, type, range
import { BUILD, EDITOR } from 'internal:constants';
import { SpriteAtlas } from '../assets/sprite-atlas';
import { SpriteFrame } from '../assets/sprite-frame';
import { Vec2, cclegacy, ccenum, clamp, warn } from '../../core';
import { Vec2, cclegacy, ccenum, clamp } from '../../core';
import { IBatcher } from '../renderer/i-batcher';
import { UIRenderer, InstanceMaterialType } from '../framework/ui-renderer';
import { PixelFormat } from '../../asset/assets/asset-enum';
Expand Down Expand Up @@ -480,9 +480,9 @@ export class Sprite extends UIRenderer {
public __preload (): void {
this.changeMaterialForDefine();
super.__preload();
this._applySpriteSize();

if (EDITOR) {
this._resized();
this.node.on(NodeEventType.SIZE_CHANGED, this._resized, this);
}
}
Expand Down Expand Up @@ -526,7 +526,7 @@ export class Sprite extends UIRenderer {
*/
public changeSpriteFrameFromAtlas (name: string): void {
if (!this._atlas) {
warn('SpriteAtlas is null.');
console.warn('SpriteAtlas is null.');

Check failure on line 529 in cocos/2d/components/sprite.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected console statement
return;
}
const sprite = this._atlas.getSpriteFrame(name);
Expand Down

0 comments on commit 02f35dd

Please sign in to comment.