diff --git a/public/libs/maps.js b/public/libs/maps.js index 46a9c5f..22f7305 100644 --- a/public/libs/maps.js +++ b/public/libs/maps.js @@ -1477,33 +1477,33 @@ maps.prototype.generateGroundPattern = function (floorId) { maps.prototype.drawMap = function (floorId) { floorId = floorId || core.status.floorId; if (!floorId) return; - core.clearMap('all'); - this.generateGroundPattern(floorId); + // core.clearMap('all'); + // this.generateGroundPattern(floorId); core.status.floorId = floorId; core.extractBlocks(floorId); core.status.thisMap = core.status.maps[floorId]; - this._drawMap_drawAll(); - if (core.status.curtainColor) { - core.fillRect( - 'curtain', - 0, - 0, - core._PX_, - core._PY_, - core.arrayToRGBA(core.status.curtainColor) - ); - } - core.drawHero(); + // this._drawMap_drawAll(); + // if (core.status.curtainColor) { + // core.fillRect( + // 'curtain', + // 0, + // 0, + // core._PX_, + // core._PY_, + // core.arrayToRGBA(core.status.curtainColor) + // ); + // } + // core.drawHero(); core.updateStatusBar(); }; ////// 重绘某张地图 ////// maps.prototype.redrawMap = function () { - core.bigmap.canvas.forEach(function (one) { - core.clearMap(one); - }); - this._drawMap_drawAll(null, { redraw: true }); + // core.bigmap.canvas.forEach(function (one) { + // core.clearMap(one); + // }); + // this._drawMap_drawAll(null, { redraw: true }); core.drawDamage(); }; diff --git a/src/core/render/item.ts b/src/core/render/item.ts index aa6e821..2bde2ec 100644 --- a/src/core/render/item.ts +++ b/src/core/render/item.ts @@ -162,6 +162,8 @@ export abstract class RenderItem antiAliasing: boolean = true; /** 是否被隐藏 */ hidden: boolean = false; + /** 滤镜 */ + filter: string = 'none'; /** 当前元素的父元素 */ parent?: RenderItem & IRenderChildable; @@ -226,6 +228,7 @@ export abstract class RenderItem const ay = -this.anchorY * this.height; canvas.ctx.save(); + canvas.ctx.filter = this.filter; canvas.setAntiAliasing(this.antiAliasing); if (this.type === 'static') transformCanvas(canvas, tran); if (this.enableCache) { @@ -257,6 +260,15 @@ export abstract class RenderItem this.transform.setTranslate(x, y); } + /** + * 设置本元素的滤镜 + * @param filter 滤镜 + */ + seyFilter(filter: string) { + this.filter = filter; + this.update(this); + } + setAnchor(x: number, y: number): void { this.anchorX = x; this.anchorY = y;