Commit fbb51781 authored by rockyl's avatar rockyl

有内容的节点内容变化后也要调整节点

parent d48d3204
......@@ -202,7 +202,6 @@ export class TextField extends Sprite {
this._lineSpacing = value;
this.dirty = true;
}
;
}
public get lineSpacing(): number {
......@@ -255,7 +254,7 @@ export class TextField extends Sprite {
this.dirty = true;
}
private _text: string = "";
protected _text: string = "";
/**
* 文本的css字体样式
......@@ -321,7 +320,7 @@ export class TextField extends Sprite {
return this._fillColor;
}
private _fillColor: any = "#ffffff";
private _fillColor: any = "#000";
/**
* 文本的描边颜色值
......
......@@ -63,11 +63,13 @@ class AdjustProxy {
onAddedToStage(e) {
this._host.parent.addEventListener(Event.RESIZE, this.onResize, this);
this._host.addEventListener(Event.RESIZE, this.onResize, this);
this._host.addEventListener(Event.ENTER_FRAME, this.onEnterFrame, this);
}
onRemovedFromStage(e) {
this._host.parent.removeEventListener(Event.RESIZE, this.onResize);
this._host.removeEventListener(Event.RESIZE, this.onResize, this);
this._host.removeEventListener(Event.ENTER_FRAME, this.onEnterFrame);
}
......
......@@ -6,6 +6,7 @@ import Texture from "../../../2d/texture/Texture";
import {getAssetByName, getAssetByUUID} from "../assets-manager";
import {dataCenter} from "../data-center";
import {ESCAPE_REG_EXP} from "../../utils";
import {Event} from "../../../2d/events";
const assetScheme = 'asset://';
......@@ -49,6 +50,7 @@ export class Image extends Sprite {
}
private _setSource(value){
if(value !== this._source){
let matchResult = value.match(ESCAPE_REG_EXP);
if (matchResult) {
......@@ -67,6 +69,9 @@ export class Image extends Sprite {
} else {
this._setSourceDirect(value);
}
this.dispatchEvent(Event.RESIZE);
}
}
/**
......
......@@ -4,6 +4,7 @@
import {TextField} from "../../../2d/text";
import {dataCenter} from "../data-center";
import {ESCAPE_REG_EXP} from "../../utils";
import {Event} from "../../../2d/events";
/**
* 文本
......@@ -19,6 +20,7 @@ export class Label extends TextField {
* @private
*/
protected _setText(value) {
if(value !== this._text){
let matchResult = value.match(ESCAPE_REG_EXP);
if (matchResult) {
......@@ -37,6 +39,9 @@ export class Label extends TextField {
} else {
super._setText(value);
}
this.dispatchEvent(Event.RESIZE);
}
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment