Move Path#_setStyles() to Item, so it can be used in PointText too.

This commit is contained in:
Jürg Lehni 2011-12-19 21:25:39 +01:00
parent 466857659c
commit f5c1125709
2 changed files with 17 additions and 12 deletions

View file

@ -2371,6 +2371,23 @@ function(name) {
* the specified type}
*/
/**
* Private method that sets Path related styles on the canvas context.
* Not defined in Path as it is required by other classes too,
* e.g. PointText.
*/
_setStyles: function(ctx) {
var style = this._style,
width = style.getStrokeWidth(),
join = style.getStrokeJoin(),
cap = style.getStrokeCap(),
limit = style.getMiterLimit();
if (width != null) ctx.lineWidth = width;
if (join) ctx.lineJoin = join;
if (cap) ctx.lineCap = cap;
if (limit) ctx.miterLimit = limit;
},
statics: {
drawSelectedBounds: function(bounds, ctx, matrix) {
var coords = matrix._transformCorners(bounds);

View file

@ -1386,18 +1386,6 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
}
return {
_setStyles: function(ctx) {
var style = this._style,
width = style.getStrokeWidth(),
join = style.getStrokeJoin(),
cap = style.getStrokeCap(),
limit = style.getMiterLimit();
if (width != null) ctx.lineWidth = width;
if (join) ctx.lineJoin = join;
if (cap) ctx.lineCap = cap;
if (limit) ctx.miterLimit = limit;
},
draw: function(ctx, param) {
if (!param.compound)
ctx.beginPath();