changed fillStroke() to fillStrokeShape() for consistency

This commit is contained in:
Eric Rowell
2013-09-02 11:09:30 -07:00
parent 159959a077
commit c802935208
16 changed files with 36 additions and 22 deletions

View File

@@ -59,6 +59,14 @@
return this.traceArr.join(';'); return this.traceArr.join(';');
}, },
/**
* clear trace if trace is enabled
* @method
* @memberof Kinetic.Context.prototype
*/
clearTrace: function() {
this.traceArr = [];
},
_trace: function(str) { _trace: function(str) {
var traceArr = this.traceArr, var traceArr = this.traceArr,
len; len;
@@ -79,6 +87,12 @@
var pixelRatio = this.getCanvas().getPixelRatio(); var pixelRatio = this.getCanvas().getPixelRatio();
this.setTransform(1 * pixelRatio, 0, 0, 1 * pixelRatio, 0, 0); this.setTransform(1 * pixelRatio, 0, 0, 1 * pixelRatio, 0, 0);
}, },
/**
* get canvas
* @method
* @memberof Kinetic.Context.prototype
* @returns {Kinetic.Canvas}
*/
getCanvas: function() { getCanvas: function() {
return this.canvas; return this.canvas;
}, },
@@ -123,14 +137,14 @@
} }
}, },
/** /**
* fill, stroke, and apply shadows * fill, stroke, and apply shadows to shape. Shadows
* will only be applied to either the fill or stroke.  Fill * will only be applied to either the fill or stroke.  Fill
* is given priority over stroke. * is given priority over stroke.
* @method * @method
* @memberof Kinetic.Context.prototype * @memberof Kinetic.Context.prototype
* @param {Kinetic.Shape} shape * @param {Kinetic.Shape} shape
*/ */
fillStroke: function(shape) { fillStrokeShape: function(shape) {
var fillEnabled = shape.getFillEnabled(); var fillEnabled = shape.getFillEnabled();
if(fillEnabled) { if(fillEnabled) {
this._fill(shape); this._fill(shape);

View File

@@ -218,7 +218,7 @@
} }
_context.closePath(); _context.closePath();
context.fillStroke(this); context.fillStrokeShape(this);
} }
}; };

View File

@@ -45,7 +45,7 @@
_context.lineTo(x, y); _context.lineTo(x, y);
} }
_context.closePath(); _context.closePath();
context.fillStroke(this); context.fillStrokeShape(this);
} }
}; };
Kinetic.Util.extend(Kinetic.RegularPolygon, Kinetic.Shape); Kinetic.Util.extend(Kinetic.RegularPolygon, Kinetic.Shape);

View File

@@ -49,7 +49,7 @@
} }
_context.closePath(); _context.closePath();
context.fillStroke(this); context.fillStrokeShape(this);
} }
}; };
Kinetic.Util.extend(Kinetic.Star, Kinetic.Shape); Kinetic.Util.extend(Kinetic.Star, Kinetic.Shape);

View File

@@ -85,7 +85,7 @@
_context.rotate(glyphInfo[i].rotation); _context.rotate(glyphInfo[i].rotation);
this.partialText = glyphInfo[i].text; this.partialText = glyphInfo[i].text;
context.fillStroke(this); context.fillStrokeShape(this);
_context.restore(); _context.restore();
//// To assist with debugging visually, uncomment following //// To assist with debugging visually, uncomment following

View File

@@ -66,7 +66,7 @@
} }
_context.closePath(); _context.closePath();
context.fillStroke(this); context.fillStrokeShape(this);
}, },
_setAllPoints: function() { _setAllPoints: function() {
var points = this.getPoints(), var points = this.getPoints(),

View File

@@ -45,7 +45,7 @@
context.beginPath(); context.beginPath();
context.arc(0, 0, this.getRadius(), 0, PIx2, false); context.arc(0, 0, this.getRadius(), 0, PIx2, false);
context.closePath(); context.closePath();
context.fillStroke(this); context.fillStrokeShape(this);
}, },
getWidth: function() { getWidth: function() {
return this.getRadius() * 2; return this.getRadius() * 2;

View File

@@ -34,7 +34,7 @@
_context.arc(0, 0, r.x, 0, PIx2, false); _context.arc(0, 0, r.x, 0, PIx2, false);
_context.restore(); _context.restore();
_context.closePath(); _context.closePath();
context.fillStroke(this); context.fillStrokeShape(this);
}, },
getWidth: function() { getWidth: function() {
return this.getRadius().x * 2; return this.getRadius().x * 2;

View File

@@ -69,7 +69,7 @@
_context.beginPath(); _context.beginPath();
_context.rect(0, 0, width, height); _context.rect(0, 0, width, height);
_context.closePath(); _context.closePath();
context.fillStroke(this); context.fillStrokeShape(this);
if(image) { if(image) {
// if cropping // if cropping
@@ -108,7 +108,7 @@
_context.beginPath(); _context.beginPath();
_context.rect(0, 0, width, height); _context.rect(0, 0, width, height);
_context.closePath(); _context.closePath();
context.fillStroke(this); context.fillStrokeShape(this);
} }
}, },
applyFilter: function() { applyFilter: function() {

View File

@@ -38,7 +38,7 @@
_context.lineTo(points[n].x, points[n].y); _context.lineTo(points[n].x, points[n].y);
} }
_context.closePath(); _context.closePath();
context.fillStroke(this); context.fillStrokeShape(this);
} }
}; };
Kinetic.Util.extend(Kinetic.Polygon, Kinetic.Shape); Kinetic.Util.extend(Kinetic.Polygon, Kinetic.Shape);

View File

@@ -50,7 +50,7 @@
context.arc(cornerRadius, cornerRadius, cornerRadius, Math.PI, Math.PI * 3 / 2, false); context.arc(cornerRadius, cornerRadius, cornerRadius, Math.PI, Math.PI * 3 / 2, false);
} }
context.closePath(); context.closePath();
context.fillStroke(this); context.fillStrokeShape(this);
} }
}; };

View File

@@ -125,7 +125,7 @@
} }
this.partialText = text; this.partialText = text;
context.fillStroke(this); context.fillStrokeShape(this);
_context.restore(); _context.restore();
_context.translate(0, lineHeightPx); _context.translate(0, lineHeightPx);
} }
@@ -139,7 +139,7 @@
_context.beginPath(); _context.beginPath();
_context.rect(0, 0, width, height); _context.rect(0, 0, width, height);
_context.closePath(); _context.closePath();
context.fillStroke(this); context.fillStrokeShape(this);
}, },
/** /**
* set text * set text

View File

@@ -38,7 +38,7 @@
_context.arc(0, 0, this.getRadius(), 0, this.getAngle(), this.getClockwise()); _context.arc(0, 0, this.getRadius(), 0, this.getAngle(), this.getClockwise());
_context.lineTo(0, 0); _context.lineTo(0, 0);
_context.closePath(); _context.closePath();
context.fillStroke(this); context.fillStrokeShape(this);
} }
}; };
Kinetic.Util.extend(Kinetic.Wedge, Kinetic.Shape); Kinetic.Util.extend(Kinetic.Wedge, Kinetic.Shape);

View File

@@ -1414,7 +1414,7 @@ Test.Modules['HIT FUNCS'] = {
_context.beginPath(); _context.beginPath();
_context.arc(0, 0, this.getRadius() + 100, 0, Math.PI * 2, true); _context.arc(0, 0, this.getRadius() + 100, 0, Math.PI * 2, true);
_context.closePath(); _context.closePath();
context.fillStroke(this); context.fillStrokeShape(this);
} }
}); });
@@ -1470,7 +1470,7 @@ Test.Modules['HIT FUNCS'] = {
_context.beginPath(); _context.beginPath();
_context.arc(0, 0, this.getRadius() - 50, 0, Math.PI * 2, true); _context.arc(0, 0, this.getRadius() - 50, 0, Math.PI * 2, true);
_context.closePath(); _context.closePath();
context.fillStroke(this); context.fillStrokeShape(this);
}); });

View File

@@ -2140,7 +2140,7 @@ Test.Modules.NODE = {
_context.lineTo(420, 80); _context.lineTo(420, 80);
_context.quadraticCurveTo(300, 100, 260, 170); _context.quadraticCurveTo(300, 100, 260, 170);
_context.closePath(); _context.closePath();
context.fillStroke(this); context.fillStrokeShape(this);
}; };
var triangle = new Kinetic.Shape({ var triangle = new Kinetic.Shape({
drawFunc: drawTriangle, drawFunc: drawTriangle,
@@ -2174,7 +2174,7 @@ Test.Modules.NODE = {
_context.lineTo(420, 80); _context.lineTo(420, 80);
_context.quadraticCurveTo(300, 100, 260, 170); _context.quadraticCurveTo(300, 100, 260, 170);
_context.closePath(); _context.closePath();
context.fillStroke(this); context.fillStrokeShape(this);
}; };
var json = '{"attrs":{"width":578,"height":200},"nodeType":"Stage","children":[{"attrs":{},"nodeType":"Layer","children":[{"attrs":{},"nodeType":"Group","children":[{"attrs":{"fill":"#00D2FF","stroke":"black","strokeWidth":4,"id":"myTriangle"},"nodeType":"Shape"}]}]}]}'; var json = '{"attrs":{"width":578,"height":200},"nodeType":"Stage","children":[{"attrs":{},"nodeType":"Layer","children":[{"attrs":{},"nodeType":"Group","children":[{"attrs":{"fill":"#00D2FF","stroke":"black","strokeWidth":4,"id":"myTriangle"},"nodeType":"Shape"}]}]}]}';

View File

@@ -135,7 +135,7 @@ Test.Modules.SHAPE = {
_context.lineTo(100, 0); _context.lineTo(100, 0);
_context.lineTo(100, 100); _context.lineTo(100, 100);
_context.closePath(); _context.closePath();
context.fillStroke(this); context.fillStrokeShape(this);
}, },
x: 10, x: 10,
y: 10, y: 10,
@@ -172,7 +172,7 @@ Test.Modules.SHAPE = {
_context.lineTo(100, 0); _context.lineTo(100, 0);
_context.lineTo(100, 100); _context.lineTo(100, 100);
_context.closePath(); _context.closePath();
context.fillStroke(this); context.fillStrokeShape(this);
}, },
x: 200, x: 200,
y: 100, y: 100,