mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Move Path#_setStyles() to Item, so it can be used in PointText too.
This commit is contained in:
parent
466857659c
commit
f5c1125709
2 changed files with 17 additions and 12 deletions
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue