#21 完善 gapxy

This commit is contained in:
YHH
2020-08-08 09:06:32 +08:00
parent 463c64c628
commit e7fb9e0d6b
8 changed files with 40 additions and 20 deletions

View File

@@ -95,11 +95,6 @@ module es {
}
public set gapXY(value: Vector2){
if (value.x < 0 || value.y < 0){
console.error("间隔必须为正数");
return;
}
this._gapX = value.x;
this._gapY = value.y;
@@ -111,7 +106,11 @@ module es {
newRectangle.height += this._gapY;
renderTexture.drawToTexture(this.displayObject, newRectangle);
this.displayObject = new Bitmap(renderTexture);
if (!this.displayObject){
this.displayObject = new Bitmap(renderTexture);
}else{
(this.displayObject as Bitmap).texture = renderTexture;
}
}
protected _sourceRect: Rectangle;
@@ -128,6 +127,15 @@ module es {
bitmap.$fillMode = egret.BitmapFillMode.REPEAT;
}
/**
* 设置间隔
* @param value
*/
public setGapXY(value: Vector2): TiledSpriteRenderer {
this.gapXY = value;
return this;
}
public render(camera: es.Camera) {
super.render(camera);