mirror of
https://github.com/konvajs/konva.git
synced 2025-11-18 17:21:36 +08:00
moved line cap logic to shape level so that Path can also utilize line caps
This commit is contained in:
36
dist/kinetic-core.js
vendored
36
dist/kinetic-core.js
vendored
@@ -4067,10 +4067,16 @@ Kinetic.Shape.prototype = {
|
||||
this.drawImage.apply(this, a);
|
||||
}
|
||||
},
|
||||
applyOpacity: function(context) {
|
||||
var absOpacity = this.getAbsoluteOpacity();
|
||||
if(absOpacity !== 1) {
|
||||
context.globalAlpha = absOpacity;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* helper method to set the line join of a shape
|
||||
* based on the lineJoin property
|
||||
* @name applyLineJoin
|
||||
* based on the applyLineJoin property
|
||||
* @name lineJoin
|
||||
* @methodOf Kinetic.Shape.prototype
|
||||
*/
|
||||
applyLineJoin: function(context) {
|
||||
@@ -4078,6 +4084,17 @@ Kinetic.Shape.prototype = {
|
||||
context.lineJoin = this.attrs.lineJoin;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* helper method to set the line cap of a path
|
||||
* based on the lineCap property
|
||||
* @name applyLineCap
|
||||
* @methodOf Kinetic.Shape.prototype
|
||||
*/
|
||||
applyLineCap: function(context) {
|
||||
if(this.attrs.lineCap) {
|
||||
context.lineCap = this.attrs.lineCap;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* set shadow object
|
||||
* @name setShadow
|
||||
@@ -4191,7 +4208,7 @@ Kinetic.Shape.prototype = {
|
||||
return p[3] > 0;
|
||||
},
|
||||
remove: function() {
|
||||
Kinetic.Node.prototype.remove.call(this);
|
||||
Kinetic.Node.prototype.remove.call(this);
|
||||
delete Kinetic.Global.shapes[this.colorKey];
|
||||
},
|
||||
__draw: function(canvas) {
|
||||
@@ -4215,14 +4232,9 @@ Kinetic.Shape.prototype = {
|
||||
context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
||||
}
|
||||
|
||||
/*
|
||||
* pre styles include opacity, linejoin
|
||||
*/
|
||||
var absOpacity = this.getAbsoluteOpacity();
|
||||
if(absOpacity !== 1) {
|
||||
context.globalAlpha = absOpacity;
|
||||
}
|
||||
this.applyOpacity(context);
|
||||
this.applyLineJoin(context);
|
||||
this.applyLineCap(context);
|
||||
|
||||
// draw the shape
|
||||
this.appliedShadow = false;
|
||||
@@ -5278,10 +5290,6 @@ Kinetic.Line.prototype = {
|
||||
}
|
||||
}
|
||||
|
||||
if(!!this.attrs.lineCap) {
|
||||
context.lineCap = this.attrs.lineCap;
|
||||
}
|
||||
|
||||
this.stroke(context);
|
||||
},
|
||||
/**
|
||||
|
||||
4
dist/kinetic-core.min.js
vendored
4
dist/kinetic-core.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user