Skip to content

Commit b9f6c99

Browse files
committed
Add comments and clean up code.
1 parent 427cc21 commit b9f6c99

3 files changed

Lines changed: 2 additions & 9 deletions

File tree

src/item/Item.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,7 +1817,6 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{
18171817
draw: function(item, ctx, param) {
18181818
if (!item._visible || item._opacity == 0)
18191819
return;
1820-
18211820
var tempCanvas, parentCtx;
18221821
// If the item has a blendMode or is defining an opacity, draw it on
18231822
// a temporary canvas first and composite the canvas afterwards.
@@ -1832,21 +1831,17 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{
18321831
var bounds = item.getStrokeBounds() || item.getBounds();
18331832
if (!bounds.width || !bounds.height)
18341833
return;
1835-
18361834
// Floor the offset and ceil the size, so we don't cut off any
18371835
// antialiased pixels when drawing onto the temporary canvas.
18381836
var itemOffset = bounds.getTopLeft().floor(),
18391837
size = bounds.getSize().ceil().add(new Size(1, 1));
18401838
tempCanvas = CanvasProvider.getCanvas(size);
1841-
18421839
// Save the parent context, so we can draw onto it later
18431840
parentCtx = ctx;
1844-
18451841
// Set ctx to the context of the temporary canvas,
18461842
// so we draw onto it, instead of the parentCtx
18471843
ctx = tempCanvas.getContext('2d');
18481844
ctx.save();
1849-
18501845
// Translate the context so the topLeft of the item is at (0, 0)
18511846
// on the temporary canvas.
18521847
ctx.translate(-itemOffset.x, -itemOffset.y);
@@ -1859,15 +1854,12 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{
18591854
item.draw(ctx, param);
18601855
if (itemOffset)
18611856
param.offset = savedOffset;
1862-
18631857
// If we created a temporary canvas before, composite it onto the
18641858
// parent canvas:
18651859
if (tempCanvas) {
1866-
18671860
// Restore the temporary canvas to its state before the
18681861
// translation matrix was applied above.
18691862
ctx.restore();
1870-
18711863
// If the item has a blendMode, use BlendMode#process to
18721864
// composite its canvas on the parentCanvas.
18731865
if (item._blendMode !== 'normal') {
@@ -1885,7 +1877,6 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{
18851877
itemOffset.x, itemOffset.y);
18861878
parentCtx.restore();
18871879
}
1888-
18891880
// Return the temporary canvas, so it can be reused
18901881
CanvasProvider.returnCanvas(tempCanvas);
18911882
}

src/path/Path.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
215215
}
216216
var fillColor = this.getFillColor(),
217217
strokeColor = this.getStrokeColor();
218+
// Try calling transform on colors in case they are GradientColors.
218219
if (fillColor && fillColor.transform)
219220
fillColor.transform(matrix);
220221
if (strokeColor && strokeColor.transform)

src/ui/CanvasView.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ var CanvasView = View.extend(/** @lends CanvasView# */{
8989
called = false;
9090
while (item) {
9191
if (item.responds(type)) {
92+
// Create an reuse the event object if we're bubbling
9293
if (!mouseEvent)
9394
mouseEvent = new MouseEvent(type, event, point, target,
9495
// Calculate delta if lastPoint was passed

0 commit comments

Comments
 (0)