Commit 4a06aca1 authored by techird's avatar techird

支持 `node.getRenderBox(rendererType)` 获取指定渲染器渲染盒子大小

parent e6868f77
...@@ -124,6 +124,7 @@ define(function(require, exports, module) { ...@@ -124,6 +124,7 @@ define(function(require, exports, module) {
// 合并盒子 // 合并盒子
if (lastBoxes[j]) { if (lastBoxes[j]) {
node._contentBox = node._contentBox.merge(lastBoxes[j]); node._contentBox = node._contentBox.merge(lastBoxes[j]);
renderer.contentBox = lastBoxes[j];
} }
// 判断当前上下文是否应该渲染 // 判断当前上下文是否应该渲染
...@@ -201,6 +202,7 @@ define(function(require, exports, module) { ...@@ -201,6 +202,7 @@ define(function(require, exports, module) {
// 合并渲染区域 // 合并渲染区域
if (latestBox) { if (latestBox) {
node._contentBox = node._contentBox.merge(latestBox); node._contentBox = node._contentBox.merge(latestBox);
renderer.contentBox = latestBox;
} }
} }
...@@ -245,6 +247,11 @@ define(function(require, exports, module) { ...@@ -245,6 +247,11 @@ define(function(require, exports, module) {
getContentBox: function() { getContentBox: function() {
//if (!this._contentBox) this.render(); //if (!this._contentBox) this.render();
return this.parent && this.parent.isCollapsed() ? new kity.Box() : (this._contentBox || new kity.Box()); return this.parent && this.parent.isCollapsed() ? new kity.Box() : (this._contentBox || new kity.Box());
},
getRenderBox: function(rendererType, refer) {
var contentBox = rendererType ? this.getRenderer(rendererType).contentBox : this.getContentBox();
var ctm = kity.Matrix.getCTM(this.getRenderContainer(), refer || 'paper');
return ctm.transformBox(contentBox);
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment