Skip to content

Commit

Permalink
Merge pull request layabox#290 from Lurenyiabc/master
Browse files Browse the repository at this point in the history
Modified the initialization problem of UIComponent ColorPicker
  • Loading branch information
lirongf authored Jun 8, 2020
2 parents a8d4c96 + b6fa931 commit 301c9fa
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 21 deletions.
39 changes: 24 additions & 15 deletions src/layaAir/laya/ui/ColorPicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,20 @@ export class ColorPicker extends UIComponent {
/** @private */
protected _panelChanged: boolean;

/**
* @inheritDoc
* @override
*/
/*override*/ destroy(destroyChild: boolean = true): void {
constructor(createChildren = true){
super(false);
if(createChildren){
this.preinitialize();
this.createChildren();
this.initialize();
}
}
/**
* @inheritDoc
* @override
*/
destroy(destroyChild: boolean = true): void {
ILaya.stage.off(Event.MOUSE_DOWN, this, this.removeColorBox);
super.destroy(destroyChild);
this._colorPanel && this._colorPanel.destroy(destroyChild);
this._colorButton && this._colorButton.destroy(destroyChild);
Expand All @@ -178,11 +187,11 @@ export class ColorPicker extends UIComponent {
this.changeHandler = null;
}

/**
* @inheritDoc
* @override
*/
/*override*/ protected createChildren(): void {
/**
* @inheritDoc
* @override
*/
protected createChildren(): void {
this.addChild(this._colorButton = new Button());
this._colorPanel = new Box();
this._colorPanel.size(230, 166);
Expand All @@ -191,11 +200,11 @@ export class ColorPicker extends UIComponent {
this._colorPanel.addChild(this._colorInput = new Input());
}

/**
* @inheritDoc
* @override
*/
/*override*/ protected initialize(): void {
/**
* @inheritDoc
* @override
*/
protected initialize(): void {
this._colorButton.on(Event.CLICK, this, this.onColorButtonClick);

this._colorBlock.pos(5, 5);
Expand Down
12 changes: 6 additions & 6 deletions src/layaAir/laya/ui/Image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ export class Image extends UIComponent {
this.skin = skin;
}

/**
* @inheritDoc
* @override
*/
/*override*/ destroy(destroyChild: boolean = true): void {
super.destroy(true);
/**
* @inheritDoc
* @override
*/
destroy(destroyChild: boolean = true): void {
super.destroy(destroyChild);
this._bitmap && this._bitmap.destroy();
this._bitmap = null;
}
Expand Down
3 changes: 3 additions & 0 deletions src/layaAir/laya/utils/SceneUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@ class InitTool {
//TODO:coverage
addLoadRes(url: string, type: string = null): void {
if (!this._loadList) this._loadList = [];
if (ILaya.loader.getRes(url)) {
return;
}
if (!type) {
this._loadList.push(url);
} else {
Expand Down

0 comments on commit 301c9fa

Please sign in to comment.