mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2025-09-24 08:14:36 +00:00
[engine] 支持高 DPI 渲染
This commit is contained in:
@@ -587,6 +587,13 @@ let Label = cc.Class({
|
||||
type: RenderComponent.EnableType,
|
||||
default: RenderComponent.EnableType.GLOBAL,
|
||||
},
|
||||
enableRetina: {
|
||||
type: RenderComponent.EnableType,
|
||||
default: RenderComponent.EnableType.GLOBAL,
|
||||
notify(oldValue) {
|
||||
this.setVertsDirty();
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
statics: {
|
||||
|
@@ -439,6 +439,26 @@ let RichText = cc.Class({
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
enableRetina: {
|
||||
type: RenderComponent.EnableType,
|
||||
default: RenderComponent.EnableType.GLOBAL,
|
||||
notify: function (oldValue) {
|
||||
if (this.enableRetina === oldValue) return;
|
||||
for (let i = 0; i < this._labelSegments.length; i++) {
|
||||
const labelComponent = this._labelSegments[i].getComponent(cc.Label);
|
||||
if (labelComponent) {
|
||||
labelComponent.enableRetina = this.enableRetina;
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < this._labelSegmentsCache.length; i++) {
|
||||
const labelComponent = this._labelSegmentsCache[i].getComponent(cc.Label);
|
||||
if (labelComponent) {
|
||||
labelComponent.enableRetina = this.enableRetina;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
statics: {
|
||||
@@ -1053,6 +1073,7 @@ let RichText = cc.Class({
|
||||
|
||||
labelComponent.autoSwitchMaterial = this.autoSwitchMaterial;
|
||||
labelComponent.allowDynamicAtlas = this.allowDynamicAtlas;
|
||||
labelComponent.enableRetina = this.enableRetina;
|
||||
|
||||
// 更新材质
|
||||
if (this.customMaterial) {
|
||||
|
Reference in New Issue
Block a user