Skip to content

Commit

Permalink
Merge pull request #1021 from antvis/chore-group-draw
Browse files Browse the repository at this point in the history
chore: group和canvas的drawInner统一到container里
  • Loading branch information
zengyue committed Sep 3, 2020
2 parents 1c52736 + c94804f commit 58f2481
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
6 changes: 1 addition & 5 deletions src/graphic/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,7 @@ class Canvas extends EventEmit {
self.beforeDraw();
try {
const context = self._attrs.context;
const children = self._attrs.children;
for (let i = 0, len = children.length; i < len; i++) {
const child = children[i];
child.draw(context);
}
self.drawInner(context);

// 支付宝,微信小程序,需要调context.draw才能完成绘制, 所以这里直接判断是否有.draw方法
if (context.draw) {
Expand Down
9 changes: 9 additions & 0 deletions src/graphic/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ export default {
return this;
},

drawInner(context) {
const children = this.get('children');
for (let i = 0, len = children.length; i < len; i++) {
const child = children[i];
child.draw(context);
}
return this;
},

clear() {
const children = this.get('children');

Expand Down
9 changes: 0 additions & 9 deletions src/graphic/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@ class Group extends Element {
};
}

drawInner(context) {
const children = this.get('children');
for (let i = 0, len = children.length; i < len; i++) {
const child = children[i];
child.draw(context);
}
return this;
}

getBBox() {
const self = this;
let minX = Infinity;
Expand Down

0 comments on commit 58f2481

Please sign in to comment.