Commit 86c79220 authored by rockyl's avatar rockyl

修复包围盒计算

parent 3088fd51
......@@ -4,6 +4,7 @@ import {getRGBA, hex2string} from "../utils/index";
import {ObservablePoint, Rectangle} from "../math/index";
import Sprite from "../display/Sprite";
import {Event} from "../events/index";
import {DisplayObject} from "../display/DisplayObject";
//文本canvas上xy的偏移量
const padding = 50;
......@@ -925,12 +926,20 @@ export class TextField extends Sprite {
* @private
*/
_calculateBounds() {
const {width, height} = this._localBoundsSelf;
/*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;
this._bounds.height = height;*/
const rect = this._localBoundsSelf;
var matrix = this.transform.worldMatrix;
matrix.transformPoint(rect.x, rect.y, DisplayObject._p1);
matrix.transformPoint(rect.x + rect.width, rect.y, DisplayObject._p2);
matrix.transformPoint(rect.x + rect.width, rect.y + rect.height, DisplayObject._p3);
matrix.transformPoint(rect.x, rect.y + rect.height, DisplayObject._p4);
Rectangle.createFromPoints(this._bounds, DisplayObject._p1, DisplayObject._p2, DisplayObject._p3, DisplayObject._p4);
}
/**
......
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