Fix:修复切换主题时,被收起的节点样式没有变化的问题
This commit is contained in:
parent
59b2506884
commit
7bd467a330
@ -397,6 +397,10 @@ class Render {
|
|||||||
|
|
||||||
// 渲染
|
// 渲染
|
||||||
render(callback = () => {}, source) {
|
render(callback = () => {}, source) {
|
||||||
|
// 切换主题时,被收起的节点需要添加样式复位的标注
|
||||||
|
if (source === CONSTANTS.CHANGE_THEME) {
|
||||||
|
this.resetUnExpandNodeStyle()
|
||||||
|
}
|
||||||
// 如果当前还没有渲染完毕,不再触发渲染
|
// 如果当前还没有渲染完毕,不再触发渲染
|
||||||
if (this.isRendering) {
|
if (this.isRendering) {
|
||||||
// 等待当前渲染完毕后再进行一次渲染
|
// 等待当前渲染完毕后再进行一次渲染
|
||||||
@ -455,6 +459,18 @@ class Render {
|
|||||||
this.emitNodeActiveEvent()
|
this.emitNodeActiveEvent()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 给当前被收起来的节点数据添加文本复位标志
|
||||||
|
resetUnExpandNodeStyle() {
|
||||||
|
walk(this.renderTree, null, node => {
|
||||||
|
if (!node.data.expand) {
|
||||||
|
walk(node, null, node2 => {
|
||||||
|
node2.data.resetRichText = true
|
||||||
|
})
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 清除当前所有激活节点,并会触发事件
|
// 清除当前所有激活节点,并会触发事件
|
||||||
clearActiveNode() {
|
clearActiveNode() {
|
||||||
if (this.activeNodeList.length <= 0) {
|
if (this.activeNodeList.length <= 0) {
|
||||||
|
|||||||
@ -186,6 +186,9 @@ function createTextNode() {
|
|||||||
if (this.getData('richText')) {
|
if (this.getData('richText')) {
|
||||||
return this.createRichTextNode()
|
return this.createRichTextNode()
|
||||||
}
|
}
|
||||||
|
if (this.getData('resetRichText')) {
|
||||||
|
delete this.nodeData.data.resetRichText
|
||||||
|
}
|
||||||
let g = new G()
|
let g = new G()
|
||||||
let fontSize = this.getStyle('fontSize', false)
|
let fontSize = this.getStyle('fontSize', false)
|
||||||
let lineHeight = this.getStyle('lineHeight', false)
|
let lineHeight = this.getStyle('lineHeight', false)
|
||||||
|
|||||||
@ -85,8 +85,12 @@ class Base {
|
|||||||
newNode.layerIndex = layerIndex
|
newNode.layerIndex = layerIndex
|
||||||
this.cacheNode(data._node.uid, newNode)
|
this.cacheNode(data._node.uid, newNode)
|
||||||
this.checkIsLayoutChangeRerenderExpandBtnPlaceholderRect(newNode)
|
this.checkIsLayoutChangeRerenderExpandBtnPlaceholderRect(newNode)
|
||||||
// 主题或主题配置改变了需要重新计算节点大小和布局
|
// 主题或主题配置改变了、节点层级改变了,需要重新渲染节点文本等情况需要重新计算节点大小和布局
|
||||||
if (this.checkIsNeedResizeSources() || isLayerTypeChange) {
|
if (
|
||||||
|
this.checkIsNeedResizeSources() ||
|
||||||
|
isLayerTypeChange ||
|
||||||
|
newNode.getData('resetRichText')
|
||||||
|
) {
|
||||||
newNode.getSize()
|
newNode.getSize()
|
||||||
newNode.needLayout = true
|
newNode.needLayout = true
|
||||||
}
|
}
|
||||||
@ -113,9 +117,14 @@ class Base {
|
|||||||
data._node = newNode
|
data._node = newNode
|
||||||
// 主题或主题配置改变了需要重新计算节点大小和布局
|
// 主题或主题配置改变了需要重新计算节点大小和布局
|
||||||
const isResizeSource = this.checkIsNeedResizeSources()
|
const isResizeSource = this.checkIsNeedResizeSources()
|
||||||
// 节点数据改变了需要重新计算节点大小和布局
|
// 主题或主题配置改变了、节点层级改变了,需要重新渲染节点文本,节点数据改变了等情况需要重新计算节点大小和布局
|
||||||
const isNodeDataChange = lastData !== JSON.stringify(data.data)
|
const isNodeDataChange = lastData !== JSON.stringify(data.data)
|
||||||
if (isResizeSource || isNodeDataChange || isLayerTypeChange) {
|
if (
|
||||||
|
isResizeSource ||
|
||||||
|
isNodeDataChange ||
|
||||||
|
isLayerTypeChange ||
|
||||||
|
newNode.getData('resetRichText')
|
||||||
|
) {
|
||||||
newNode.getSize()
|
newNode.getSize()
|
||||||
newNode.needLayout = true
|
newNode.needLayout = true
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user