Commit 8f64ec42 authored by haiyoucuv's avatar haiyoucuv

Merge branch 'auto_align_qx' of...

Merge branch 'auto_align_qx' of http://gitlab2.dui88.com/laoqifeng/zeroing-engine into auto_align_qx
parents 75c0f50e dc88a857
import { SCALE_MODES, TEXT_ALIGN, TEXT_lINETYPE, VERTICAL_ALIGN } from "../const";
import {SCALE_MODES, TEXT_ALIGN, TEXT_lINETYPE, VERTICAL_ALIGN} from "../const";
import Texture from "../texture/Texture";
import { getRGBA, hex2string } from "../utils/index";
import { ObservablePoint, Rectangle } from "../math/index";
import {getRGBA, hex2string} from "../utils/index";
import {ObservablePoint, Rectangle} from "../math/index";
import Sprite from "../display/Sprite";
import { Event } from "../events/index";
import { toBoolean } from "../../zeroing/utils/utils";
import {Event} from "../events/index";
//文本canvas上xy的偏移量
const padding = 50;
......@@ -187,12 +186,6 @@ export class TextField extends Sprite {
}
this.dirty = true;
this.dispatchEvent(Event.RESIZE);
this.dispatchEvent(Event.MAYBE_ALIGN);
// 如果它设置了 percentWidth 或同时设置了 left 和 right 则表示他的宽度是相对的,则对于父级来说它的宽度永远是 0
this.__width = (toBoolean(this.percentWidth) || (toBoolean(this.left) && toBoolean(this.right)))
? 0
: value;
}
}
......@@ -214,12 +207,6 @@ export class TextField extends Sprite {
}
this.dirty = true;
this.dispatchEvent(Event.RESIZE);
this.dispatchEvent(Event.MAYBE_ALIGN);
// 如果它设置了 percentHeight 或同时设置了 top 和 bottom 则表示他的宽度是相对的,则对于父级来说它的高度永远是 0
this.__height = (toBoolean(this.percentHeight) || (toBoolean(this.top) && toBoolean(this.bottom)))
? 0
: value;
}
}
......@@ -939,6 +926,9 @@ export class TextField extends Sprite {
*/
_calculateBounds() {
const {width, height} = this._localBoundsSelf;
var matrix = this.transform.worldMatrix;
this._bounds.x = matrix.tx;
this._bounds.y = matrix.ty;
this._bounds.width = width;
this._bounds.height = height;
}
......
......@@ -34,7 +34,7 @@ export function objClone(obj) {
return obj ? JSON.parse(JSON.stringify(obj)) : obj;
}
const percentKeys = ['width', 'height'];
const percentKeys = ['width', 'height', 'top', 'left', 'bottom', 'right'];
export function propertyParse(key, node, properties) {
let value = properties[key];
......
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