Skip to content

Commit 0c2f593

Browse files
authored
Merge pull request #3356 from dabingnn/fix_scrollview_bug
fix scroll view canvas rendering bug
2 parents 6478421 + 1587f1a commit 0c2f593

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

extensions/ccui/layouts/UILayoutCanvasRenderCmd.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,17 @@
7575
wrapper.save();
7676
wrapper.save();
7777
wrapper.setTransform(this._worldTransform, scaleX, scaleY);
78+
var buffer = this._node._clippingStencil._renderCmd._buffer;
79+
80+
for (var i = 0, bufLen = buffer.length; i < bufLen; i++) {
81+
var element = buffer[i], vertices = element.verts;
82+
var firstPoint = vertices[0];
83+
context.beginPath();
84+
context.moveTo(firstPoint.x, -firstPoint.y );
85+
for (var j = 1, len = vertices.length; j < len; j++)
86+
context.lineTo(vertices[j].x , -vertices[j].y );
87+
context.closePath();
88+
}
7889
};
7990

8091
proto._onRenderClipCmd = function(ctx){
@@ -95,17 +106,7 @@
95106
};
96107

97108
proto.__stencilDraw = function(ctx,scaleX, scaleY){ //Only for Canvas
98-
var wrapper = ctx || cc._renderContext, locContext = wrapper.getContext(), buffer = this._buffer;
99-
100-
for (var i = 0, bufLen = buffer.length; i < bufLen; i++) {
101-
var element = buffer[i], vertices = element.verts;
102-
var firstPoint = vertices[0];
103-
locContext.beginPath();
104-
locContext.moveTo(firstPoint.x, -firstPoint.y );
105-
for (var j = 1, len = vertices.length; j < len; j++)
106-
locContext.lineTo(vertices[j].x , -vertices[j].y );
107-
locContext.closePath();
108-
}
109+
//do nothing, rendering in layout
109110
};
110111

111112
proto.stencilClippingVisit = proto.scissorClippingVisit = function (parentCmd) {

0 commit comments

Comments
 (0)