You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
864 B
36 lines
864 B
/*
|
|
author: leeenx
|
|
date: 2017.09.08
|
|
@ 获取不带描边的boudary
|
|
*/
|
|
import * as PIXI from "../pixi";
|
|
{
|
|
let dirty = Symbol("dirty");
|
|
let getContentBox = function () {
|
|
if (this[dirty] == this.dirty) return;
|
|
this[dirty] = this.dirty; // 表示已经更新
|
|
let cp = this.clone();
|
|
let graphicsData = cp.graphicsData;
|
|
for (let graphics of graphicsData) {
|
|
graphics.lineWidth = 0;
|
|
}
|
|
this._cwidth = cp.width;
|
|
this._cheight = cp.height;
|
|
};
|
|
Object.defineProperties(PIXI.Graphics.prototype, {
|
|
_cwidth: { writable: true, value: 0 },
|
|
_cheight: { writable: true, value: 0 },
|
|
cwidth: {
|
|
get: function () {
|
|
getContentBox.call(this);
|
|
return this._cwidth;
|
|
},
|
|
},
|
|
cheight: {
|
|
get: function () {
|
|
getContentBox.call(this);
|
|
return this._cheight;
|
|
},
|
|
},
|
|
});
|
|
}
|
|
|