[0]发光滤镜二次渲染bug
使用发光滤镜时发现,有时候文字会变小;调试检查代码发现,一个元素从舞台上移除后,设为了false;
_setDisplay(value) {
if (!value) {
if (this._cacheStyle) {
this._cacheStyle.releaseContext();
this._cacheStyle.releaseFilterCache();
if (this._cacheStyle.hasGlowFilter) {
this._cacheStyle.hasGlowFilter = false;
}
}
}
super._setDisplay(value);
}
而二次渲染时使用了这个值;
tIsHaveGlowFilter = sprite._cacheStyle.hasGlowFilter || false;
if (tIsHaveGlowFilter) {
tPadding = 50;
tHalfPadding = 25;
}
b = sprite.getBounds();
if (b.width <= 0 || b.height <= 0) {
return;
}
同时,发现这里区域计算与第一次渲染不一致,以下是修改后的;
//start
//发光滤镜第一次渲染的计算方式和第二次不一致,
//导致触发重新渲染时计算的位置和大小有差异,文字变模糊;
b.width += (tPadding + 8);
b.height += (tPadding + 8);
b.x -= sprite.pivotX + 4;
b.y -= sprite.pivotY + 4;
//end
最终修改后如附件,解决该问题;
_setDisplay(value) {
if (!value) {
if (this._cacheStyle) {
this._cacheStyle.releaseContext();
this._cacheStyle.releaseFilterCache();
if (this._cacheStyle.hasGlowFilter) {
this._cacheStyle.hasGlowFilter = false;
}
}
}
super._setDisplay(value);
}
而二次渲染时使用了这个值;
tIsHaveGlowFilter = sprite._cacheStyle.hasGlowFilter || false;
if (tIsHaveGlowFilter) {
tPadding = 50;
tHalfPadding = 25;
}
b = sprite.getBounds();
if (b.width <= 0 || b.height <= 0) {
return;
}
同时,发现这里区域计算与第一次渲染不一致,以下是修改后的;
//start
//发光滤镜第一次渲染的计算方式和第二次不一致,
//导致触发重新渲染时计算的位置和大小有差异,文字变模糊;
b.width += (tPadding + 8);
b.height += (tPadding + 8);
b.x -= sprite.pivotX + 4;
b.y -= sprite.pivotY + 4;
//end
最终修改后如附件,解决该问题;
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
Laya_XS
赞同来自: