mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 05:42:07 -05:00
Prebuilt module for commit e6f43da22b
This commit is contained in:
parent
fa0b73f1f3
commit
a1d304538e
5 changed files with 89 additions and 74 deletions
47
dist/docs/assets/js/paper.js
vendored
47
dist/docs/assets/js/paper.js
vendored
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Date: Sun Feb 14 13:33:56 2016 +0100
|
* Date: Sun Feb 14 13:49:40 2016 +0100
|
||||||
*
|
*
|
||||||
***
|
***
|
||||||
*
|
*
|
||||||
|
@ -4169,7 +4169,7 @@ new function() {
|
||||||
}
|
}
|
||||||
}), {
|
}), {
|
||||||
|
|
||||||
_setStyles: function(ctx) {
|
_setStyles: function(ctx, param, viewMatrix) {
|
||||||
var style = this._style;
|
var style = this._style;
|
||||||
if (style.hasFill()) {
|
if (style.hasFill()) {
|
||||||
ctx.fillStyle = style.getFillColor().toCanvasStyle(ctx);
|
ctx.fillStyle = style.getFillColor().toCanvasStyle(ctx);
|
||||||
|
@ -4201,9 +4201,13 @@ new function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (style.hasShadow()) {
|
if (style.hasShadow()) {
|
||||||
|
var pixelRatio = param.pixelRatio || 1,
|
||||||
|
mx = viewMatrix._shiftless().prepend(
|
||||||
|
new Matrix().scale(pixelRatio, pixelRatio)),
|
||||||
|
blur = mx.transform(new Point(style.getShadowBlur(), 0)),
|
||||||
|
offset = mx.transform(this.getShadowOffset());
|
||||||
ctx.shadowColor = style.getShadowColor().toCanvasStyle(ctx);
|
ctx.shadowColor = style.getShadowColor().toCanvasStyle(ctx);
|
||||||
ctx.shadowBlur = style.getShadowBlur();
|
ctx.shadowBlur = blur.getLength();
|
||||||
var offset = this.getShadowOffset();
|
|
||||||
ctx.shadowOffsetX = offset.x;
|
ctx.shadowOffsetX = offset.x;
|
||||||
ctx.shadowOffsetY = offset.y;
|
ctx.shadowOffsetY = offset.y;
|
||||||
}
|
}
|
||||||
|
@ -4220,9 +4224,8 @@ new function() {
|
||||||
if (!globalMatrix.isInvertible())
|
if (!globalMatrix.isInvertible())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
function getViewMatrix(matrix) {
|
viewMatrix = viewMatrix ? viewMatrix.appended(globalMatrix)
|
||||||
return viewMatrix ? viewMatrix.appended(matrix) : matrix;
|
: globalMatrix;
|
||||||
}
|
|
||||||
|
|
||||||
matrices.push(globalMatrix);
|
matrices.push(globalMatrix);
|
||||||
if (param.updateMatrix) {
|
if (param.updateMatrix) {
|
||||||
|
@ -4242,7 +4245,7 @@ new function() {
|
||||||
pixelRatio = param.pixelRatio || 1,
|
pixelRatio = param.pixelRatio || 1,
|
||||||
mainCtx, itemOffset, prevOffset;
|
mainCtx, itemOffset, prevOffset;
|
||||||
if (!direct) {
|
if (!direct) {
|
||||||
var bounds = this.getStrokeBounds(getViewMatrix(globalMatrix));
|
var bounds = this.getStrokeBounds(viewMatrix);
|
||||||
if (!bounds.width || !bounds.height)
|
if (!bounds.width || !bounds.height)
|
||||||
return;
|
return;
|
||||||
prevOffset = param.offset;
|
prevOffset = param.offset;
|
||||||
|
@ -4257,7 +4260,7 @@ new function() {
|
||||||
var strokeMatrix = parentStrokeMatrix
|
var strokeMatrix = parentStrokeMatrix
|
||||||
? parentStrokeMatrix.appended(matrix)
|
? parentStrokeMatrix.appended(matrix)
|
||||||
: this._canScaleStroke && !this.getStrokeScaling(true)
|
: this._canScaleStroke && !this.getStrokeScaling(true)
|
||||||
&& getViewMatrix(globalMatrix),
|
&& viewMatrix,
|
||||||
clip = !direct && param.clipItem,
|
clip = !direct && param.clipItem,
|
||||||
transform = !strokeMatrix || clip;
|
transform = !strokeMatrix || clip;
|
||||||
if (direct) {
|
if (direct) {
|
||||||
|
@ -4267,17 +4270,19 @@ new function() {
|
||||||
} else if (transform) {
|
} else if (transform) {
|
||||||
ctx.translate(-itemOffset.x, -itemOffset.y);
|
ctx.translate(-itemOffset.x, -itemOffset.y);
|
||||||
}
|
}
|
||||||
if (transform)
|
if (transform) {
|
||||||
(direct ? matrix : getViewMatrix(globalMatrix)).applyToContext(ctx);
|
(direct ? matrix : viewMatrix).applyToContext(ctx);
|
||||||
if (clip)
|
}
|
||||||
|
if (clip) {
|
||||||
param.clipItem.draw(ctx, param.extend({ clip: true }));
|
param.clipItem.draw(ctx, param.extend({ clip: true }));
|
||||||
|
}
|
||||||
if (strokeMatrix) {
|
if (strokeMatrix) {
|
||||||
ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);
|
ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);
|
||||||
var offset = param.offset;
|
var offset = param.offset;
|
||||||
if (offset)
|
if (offset)
|
||||||
ctx.translate(-offset.x, -offset.y);
|
ctx.translate(-offset.x, -offset.y);
|
||||||
}
|
}
|
||||||
this._draw(ctx, param, strokeMatrix);
|
this._draw(ctx, param, viewMatrix, strokeMatrix);
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
if (param.clip && !param.dontFinish)
|
if (param.clip && !param.dontFinish)
|
||||||
|
@ -4581,7 +4586,7 @@ var Shape = Item.extend({
|
||||||
|
|
||||||
toShape: '#clone',
|
toShape: '#clone',
|
||||||
|
|
||||||
_draw: function(ctx, param, strokeMatrix) {
|
_draw: function(ctx, param, viewMatrix, strokeMatrix) {
|
||||||
var style = this._style,
|
var style = this._style,
|
||||||
hasFill = style.hasFill(),
|
hasFill = style.hasFill(),
|
||||||
hasStroke = style.hasStroke(),
|
hasStroke = style.hasStroke(),
|
||||||
|
@ -4645,7 +4650,7 @@ var Shape = Item.extend({
|
||||||
ctx.closePath();
|
ctx.closePath();
|
||||||
}
|
}
|
||||||
if (!dontPaint && (hasFill || hasStroke)) {
|
if (!dontPaint && (hasFill || hasStroke)) {
|
||||||
this._setStyles(ctx);
|
this._setStyles(ctx, param, viewMatrix);
|
||||||
if (hasFill) {
|
if (hasFill) {
|
||||||
ctx.fill(style.getFillRule());
|
ctx.fill(style.getFillRule());
|
||||||
ctx.shadowColor = 'rgba(0,0,0,0)';
|
ctx.shadowColor = 'rgba(0,0,0,0)';
|
||||||
|
@ -8442,7 +8447,7 @@ new function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
_draw: function(ctx, param, strokeMatrix) {
|
_draw: function(ctx, param, viewMatrix, strokeMatrix) {
|
||||||
var dontStart = param.dontStart,
|
var dontStart = param.dontStart,
|
||||||
dontPaint = param.dontFinish || param.clip,
|
dontPaint = param.dontFinish || param.clip,
|
||||||
style = this.getStyle(),
|
style = this.getStyle(),
|
||||||
|
@ -8466,7 +8471,7 @@ new function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dontPaint && (hasFill || hasStroke)) {
|
if (!dontPaint && (hasFill || hasStroke)) {
|
||||||
this._setStyles(ctx);
|
this._setStyles(ctx, param, viewMatrix);
|
||||||
if (hasFill) {
|
if (hasFill) {
|
||||||
ctx.fill(style.getFillRule());
|
ctx.fill(style.getFillRule());
|
||||||
ctx.shadowColor = 'rgba(0,0,0,0)';
|
ctx.shadowColor = 'rgba(0,0,0,0)';
|
||||||
|
@ -9193,7 +9198,7 @@ var CompoundPath = PathItem.extend({
|
||||||
viewMatrix);
|
viewMatrix);
|
||||||
},
|
},
|
||||||
|
|
||||||
_draw: function(ctx, param, strokeMatrix) {
|
_draw: function(ctx, param, viewMatrix, strokeMatrix) {
|
||||||
var children = this._children;
|
var children = this._children;
|
||||||
if (children.length === 0)
|
if (children.length === 0)
|
||||||
return;
|
return;
|
||||||
|
@ -9204,7 +9209,7 @@ var CompoundPath = PathItem.extend({
|
||||||
children[i].draw(ctx, param, strokeMatrix);
|
children[i].draw(ctx, param, strokeMatrix);
|
||||||
|
|
||||||
if (!param.clip) {
|
if (!param.clip) {
|
||||||
this._setStyles(ctx);
|
this._setStyles(ctx, param, viewMatrix);
|
||||||
var style = this._style;
|
var style = this._style;
|
||||||
if (style.hasFill()) {
|
if (style.hasFill()) {
|
||||||
ctx.fill(style.getFillRule());
|
ctx.fill(style.getFillRule());
|
||||||
|
@ -10325,10 +10330,10 @@ var PointText = TextItem.extend({
|
||||||
this.translate(point.subtract(this._matrix.getTranslation()));
|
this.translate(point.subtract(this._matrix.getTranslation()));
|
||||||
},
|
},
|
||||||
|
|
||||||
_draw: function(ctx) {
|
_draw: function(ctx, param, viewMatrix) {
|
||||||
if (!this._content)
|
if (!this._content)
|
||||||
return;
|
return;
|
||||||
this._setStyles(ctx);
|
this._setStyles(ctx, param, viewMatrix);
|
||||||
var lines = this._lines,
|
var lines = this._lines,
|
||||||
style = this._style,
|
style = this._style,
|
||||||
hasFill = style.hasFill(),
|
hasFill = style.hasFill(),
|
||||||
|
|
47
dist/paper-core.js
vendored
47
dist/paper-core.js
vendored
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Date: Sun Feb 14 13:33:56 2016 +0100
|
* Date: Sun Feb 14 13:49:40 2016 +0100
|
||||||
*
|
*
|
||||||
***
|
***
|
||||||
*
|
*
|
||||||
|
@ -4169,7 +4169,7 @@ new function() {
|
||||||
}
|
}
|
||||||
}), {
|
}), {
|
||||||
|
|
||||||
_setStyles: function(ctx) {
|
_setStyles: function(ctx, param, viewMatrix) {
|
||||||
var style = this._style;
|
var style = this._style;
|
||||||
if (style.hasFill()) {
|
if (style.hasFill()) {
|
||||||
ctx.fillStyle = style.getFillColor().toCanvasStyle(ctx);
|
ctx.fillStyle = style.getFillColor().toCanvasStyle(ctx);
|
||||||
|
@ -4201,9 +4201,13 @@ new function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (style.hasShadow()) {
|
if (style.hasShadow()) {
|
||||||
|
var pixelRatio = param.pixelRatio || 1,
|
||||||
|
mx = viewMatrix._shiftless().prepend(
|
||||||
|
new Matrix().scale(pixelRatio, pixelRatio)),
|
||||||
|
blur = mx.transform(new Point(style.getShadowBlur(), 0)),
|
||||||
|
offset = mx.transform(this.getShadowOffset());
|
||||||
ctx.shadowColor = style.getShadowColor().toCanvasStyle(ctx);
|
ctx.shadowColor = style.getShadowColor().toCanvasStyle(ctx);
|
||||||
ctx.shadowBlur = style.getShadowBlur();
|
ctx.shadowBlur = blur.getLength();
|
||||||
var offset = this.getShadowOffset();
|
|
||||||
ctx.shadowOffsetX = offset.x;
|
ctx.shadowOffsetX = offset.x;
|
||||||
ctx.shadowOffsetY = offset.y;
|
ctx.shadowOffsetY = offset.y;
|
||||||
}
|
}
|
||||||
|
@ -4220,9 +4224,8 @@ new function() {
|
||||||
if (!globalMatrix.isInvertible())
|
if (!globalMatrix.isInvertible())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
function getViewMatrix(matrix) {
|
viewMatrix = viewMatrix ? viewMatrix.appended(globalMatrix)
|
||||||
return viewMatrix ? viewMatrix.appended(matrix) : matrix;
|
: globalMatrix;
|
||||||
}
|
|
||||||
|
|
||||||
matrices.push(globalMatrix);
|
matrices.push(globalMatrix);
|
||||||
if (param.updateMatrix) {
|
if (param.updateMatrix) {
|
||||||
|
@ -4242,7 +4245,7 @@ new function() {
|
||||||
pixelRatio = param.pixelRatio || 1,
|
pixelRatio = param.pixelRatio || 1,
|
||||||
mainCtx, itemOffset, prevOffset;
|
mainCtx, itemOffset, prevOffset;
|
||||||
if (!direct) {
|
if (!direct) {
|
||||||
var bounds = this.getStrokeBounds(getViewMatrix(globalMatrix));
|
var bounds = this.getStrokeBounds(viewMatrix);
|
||||||
if (!bounds.width || !bounds.height)
|
if (!bounds.width || !bounds.height)
|
||||||
return;
|
return;
|
||||||
prevOffset = param.offset;
|
prevOffset = param.offset;
|
||||||
|
@ -4257,7 +4260,7 @@ new function() {
|
||||||
var strokeMatrix = parentStrokeMatrix
|
var strokeMatrix = parentStrokeMatrix
|
||||||
? parentStrokeMatrix.appended(matrix)
|
? parentStrokeMatrix.appended(matrix)
|
||||||
: this._canScaleStroke && !this.getStrokeScaling(true)
|
: this._canScaleStroke && !this.getStrokeScaling(true)
|
||||||
&& getViewMatrix(globalMatrix),
|
&& viewMatrix,
|
||||||
clip = !direct && param.clipItem,
|
clip = !direct && param.clipItem,
|
||||||
transform = !strokeMatrix || clip;
|
transform = !strokeMatrix || clip;
|
||||||
if (direct) {
|
if (direct) {
|
||||||
|
@ -4267,17 +4270,19 @@ new function() {
|
||||||
} else if (transform) {
|
} else if (transform) {
|
||||||
ctx.translate(-itemOffset.x, -itemOffset.y);
|
ctx.translate(-itemOffset.x, -itemOffset.y);
|
||||||
}
|
}
|
||||||
if (transform)
|
if (transform) {
|
||||||
(direct ? matrix : getViewMatrix(globalMatrix)).applyToContext(ctx);
|
(direct ? matrix : viewMatrix).applyToContext(ctx);
|
||||||
if (clip)
|
}
|
||||||
|
if (clip) {
|
||||||
param.clipItem.draw(ctx, param.extend({ clip: true }));
|
param.clipItem.draw(ctx, param.extend({ clip: true }));
|
||||||
|
}
|
||||||
if (strokeMatrix) {
|
if (strokeMatrix) {
|
||||||
ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);
|
ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);
|
||||||
var offset = param.offset;
|
var offset = param.offset;
|
||||||
if (offset)
|
if (offset)
|
||||||
ctx.translate(-offset.x, -offset.y);
|
ctx.translate(-offset.x, -offset.y);
|
||||||
}
|
}
|
||||||
this._draw(ctx, param, strokeMatrix);
|
this._draw(ctx, param, viewMatrix, strokeMatrix);
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
if (param.clip && !param.dontFinish)
|
if (param.clip && !param.dontFinish)
|
||||||
|
@ -4581,7 +4586,7 @@ var Shape = Item.extend({
|
||||||
|
|
||||||
toShape: '#clone',
|
toShape: '#clone',
|
||||||
|
|
||||||
_draw: function(ctx, param, strokeMatrix) {
|
_draw: function(ctx, param, viewMatrix, strokeMatrix) {
|
||||||
var style = this._style,
|
var style = this._style,
|
||||||
hasFill = style.hasFill(),
|
hasFill = style.hasFill(),
|
||||||
hasStroke = style.hasStroke(),
|
hasStroke = style.hasStroke(),
|
||||||
|
@ -4645,7 +4650,7 @@ var Shape = Item.extend({
|
||||||
ctx.closePath();
|
ctx.closePath();
|
||||||
}
|
}
|
||||||
if (!dontPaint && (hasFill || hasStroke)) {
|
if (!dontPaint && (hasFill || hasStroke)) {
|
||||||
this._setStyles(ctx);
|
this._setStyles(ctx, param, viewMatrix);
|
||||||
if (hasFill) {
|
if (hasFill) {
|
||||||
ctx.fill(style.getFillRule());
|
ctx.fill(style.getFillRule());
|
||||||
ctx.shadowColor = 'rgba(0,0,0,0)';
|
ctx.shadowColor = 'rgba(0,0,0,0)';
|
||||||
|
@ -8442,7 +8447,7 @@ new function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
_draw: function(ctx, param, strokeMatrix) {
|
_draw: function(ctx, param, viewMatrix, strokeMatrix) {
|
||||||
var dontStart = param.dontStart,
|
var dontStart = param.dontStart,
|
||||||
dontPaint = param.dontFinish || param.clip,
|
dontPaint = param.dontFinish || param.clip,
|
||||||
style = this.getStyle(),
|
style = this.getStyle(),
|
||||||
|
@ -8466,7 +8471,7 @@ new function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dontPaint && (hasFill || hasStroke)) {
|
if (!dontPaint && (hasFill || hasStroke)) {
|
||||||
this._setStyles(ctx);
|
this._setStyles(ctx, param, viewMatrix);
|
||||||
if (hasFill) {
|
if (hasFill) {
|
||||||
ctx.fill(style.getFillRule());
|
ctx.fill(style.getFillRule());
|
||||||
ctx.shadowColor = 'rgba(0,0,0,0)';
|
ctx.shadowColor = 'rgba(0,0,0,0)';
|
||||||
|
@ -9193,7 +9198,7 @@ var CompoundPath = PathItem.extend({
|
||||||
viewMatrix);
|
viewMatrix);
|
||||||
},
|
},
|
||||||
|
|
||||||
_draw: function(ctx, param, strokeMatrix) {
|
_draw: function(ctx, param, viewMatrix, strokeMatrix) {
|
||||||
var children = this._children;
|
var children = this._children;
|
||||||
if (children.length === 0)
|
if (children.length === 0)
|
||||||
return;
|
return;
|
||||||
|
@ -9204,7 +9209,7 @@ var CompoundPath = PathItem.extend({
|
||||||
children[i].draw(ctx, param, strokeMatrix);
|
children[i].draw(ctx, param, strokeMatrix);
|
||||||
|
|
||||||
if (!param.clip) {
|
if (!param.clip) {
|
||||||
this._setStyles(ctx);
|
this._setStyles(ctx, param, viewMatrix);
|
||||||
var style = this._style;
|
var style = this._style;
|
||||||
if (style.hasFill()) {
|
if (style.hasFill()) {
|
||||||
ctx.fill(style.getFillRule());
|
ctx.fill(style.getFillRule());
|
||||||
|
@ -10325,10 +10330,10 @@ var PointText = TextItem.extend({
|
||||||
this.translate(point.subtract(this._matrix.getTranslation()));
|
this.translate(point.subtract(this._matrix.getTranslation()));
|
||||||
},
|
},
|
||||||
|
|
||||||
_draw: function(ctx) {
|
_draw: function(ctx, param, viewMatrix) {
|
||||||
if (!this._content)
|
if (!this._content)
|
||||||
return;
|
return;
|
||||||
this._setStyles(ctx);
|
this._setStyles(ctx, param, viewMatrix);
|
||||||
var lines = this._lines,
|
var lines = this._lines,
|
||||||
style = this._style,
|
style = this._style,
|
||||||
hasFill = style.hasFill(),
|
hasFill = style.hasFill(),
|
||||||
|
|
12
dist/paper-core.min.js
vendored
12
dist/paper-core.min.js
vendored
File diff suppressed because one or more lines are too long
47
dist/paper-full.js
vendored
47
dist/paper-full.js
vendored
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Date: Sun Feb 14 13:33:56 2016 +0100
|
* Date: Sun Feb 14 13:49:40 2016 +0100
|
||||||
*
|
*
|
||||||
***
|
***
|
||||||
*
|
*
|
||||||
|
@ -4169,7 +4169,7 @@ new function() {
|
||||||
}
|
}
|
||||||
}), {
|
}), {
|
||||||
|
|
||||||
_setStyles: function(ctx) {
|
_setStyles: function(ctx, param, viewMatrix) {
|
||||||
var style = this._style;
|
var style = this._style;
|
||||||
if (style.hasFill()) {
|
if (style.hasFill()) {
|
||||||
ctx.fillStyle = style.getFillColor().toCanvasStyle(ctx);
|
ctx.fillStyle = style.getFillColor().toCanvasStyle(ctx);
|
||||||
|
@ -4201,9 +4201,13 @@ new function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (style.hasShadow()) {
|
if (style.hasShadow()) {
|
||||||
|
var pixelRatio = param.pixelRatio || 1,
|
||||||
|
mx = viewMatrix._shiftless().prepend(
|
||||||
|
new Matrix().scale(pixelRatio, pixelRatio)),
|
||||||
|
blur = mx.transform(new Point(style.getShadowBlur(), 0)),
|
||||||
|
offset = mx.transform(this.getShadowOffset());
|
||||||
ctx.shadowColor = style.getShadowColor().toCanvasStyle(ctx);
|
ctx.shadowColor = style.getShadowColor().toCanvasStyle(ctx);
|
||||||
ctx.shadowBlur = style.getShadowBlur();
|
ctx.shadowBlur = blur.getLength();
|
||||||
var offset = this.getShadowOffset();
|
|
||||||
ctx.shadowOffsetX = offset.x;
|
ctx.shadowOffsetX = offset.x;
|
||||||
ctx.shadowOffsetY = offset.y;
|
ctx.shadowOffsetY = offset.y;
|
||||||
}
|
}
|
||||||
|
@ -4220,9 +4224,8 @@ new function() {
|
||||||
if (!globalMatrix.isInvertible())
|
if (!globalMatrix.isInvertible())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
function getViewMatrix(matrix) {
|
viewMatrix = viewMatrix ? viewMatrix.appended(globalMatrix)
|
||||||
return viewMatrix ? viewMatrix.appended(matrix) : matrix;
|
: globalMatrix;
|
||||||
}
|
|
||||||
|
|
||||||
matrices.push(globalMatrix);
|
matrices.push(globalMatrix);
|
||||||
if (param.updateMatrix) {
|
if (param.updateMatrix) {
|
||||||
|
@ -4242,7 +4245,7 @@ new function() {
|
||||||
pixelRatio = param.pixelRatio || 1,
|
pixelRatio = param.pixelRatio || 1,
|
||||||
mainCtx, itemOffset, prevOffset;
|
mainCtx, itemOffset, prevOffset;
|
||||||
if (!direct) {
|
if (!direct) {
|
||||||
var bounds = this.getStrokeBounds(getViewMatrix(globalMatrix));
|
var bounds = this.getStrokeBounds(viewMatrix);
|
||||||
if (!bounds.width || !bounds.height)
|
if (!bounds.width || !bounds.height)
|
||||||
return;
|
return;
|
||||||
prevOffset = param.offset;
|
prevOffset = param.offset;
|
||||||
|
@ -4257,7 +4260,7 @@ new function() {
|
||||||
var strokeMatrix = parentStrokeMatrix
|
var strokeMatrix = parentStrokeMatrix
|
||||||
? parentStrokeMatrix.appended(matrix)
|
? parentStrokeMatrix.appended(matrix)
|
||||||
: this._canScaleStroke && !this.getStrokeScaling(true)
|
: this._canScaleStroke && !this.getStrokeScaling(true)
|
||||||
&& getViewMatrix(globalMatrix),
|
&& viewMatrix,
|
||||||
clip = !direct && param.clipItem,
|
clip = !direct && param.clipItem,
|
||||||
transform = !strokeMatrix || clip;
|
transform = !strokeMatrix || clip;
|
||||||
if (direct) {
|
if (direct) {
|
||||||
|
@ -4267,17 +4270,19 @@ new function() {
|
||||||
} else if (transform) {
|
} else if (transform) {
|
||||||
ctx.translate(-itemOffset.x, -itemOffset.y);
|
ctx.translate(-itemOffset.x, -itemOffset.y);
|
||||||
}
|
}
|
||||||
if (transform)
|
if (transform) {
|
||||||
(direct ? matrix : getViewMatrix(globalMatrix)).applyToContext(ctx);
|
(direct ? matrix : viewMatrix).applyToContext(ctx);
|
||||||
if (clip)
|
}
|
||||||
|
if (clip) {
|
||||||
param.clipItem.draw(ctx, param.extend({ clip: true }));
|
param.clipItem.draw(ctx, param.extend({ clip: true }));
|
||||||
|
}
|
||||||
if (strokeMatrix) {
|
if (strokeMatrix) {
|
||||||
ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);
|
ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);
|
||||||
var offset = param.offset;
|
var offset = param.offset;
|
||||||
if (offset)
|
if (offset)
|
||||||
ctx.translate(-offset.x, -offset.y);
|
ctx.translate(-offset.x, -offset.y);
|
||||||
}
|
}
|
||||||
this._draw(ctx, param, strokeMatrix);
|
this._draw(ctx, param, viewMatrix, strokeMatrix);
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
if (param.clip && !param.dontFinish)
|
if (param.clip && !param.dontFinish)
|
||||||
|
@ -4581,7 +4586,7 @@ var Shape = Item.extend({
|
||||||
|
|
||||||
toShape: '#clone',
|
toShape: '#clone',
|
||||||
|
|
||||||
_draw: function(ctx, param, strokeMatrix) {
|
_draw: function(ctx, param, viewMatrix, strokeMatrix) {
|
||||||
var style = this._style,
|
var style = this._style,
|
||||||
hasFill = style.hasFill(),
|
hasFill = style.hasFill(),
|
||||||
hasStroke = style.hasStroke(),
|
hasStroke = style.hasStroke(),
|
||||||
|
@ -4645,7 +4650,7 @@ var Shape = Item.extend({
|
||||||
ctx.closePath();
|
ctx.closePath();
|
||||||
}
|
}
|
||||||
if (!dontPaint && (hasFill || hasStroke)) {
|
if (!dontPaint && (hasFill || hasStroke)) {
|
||||||
this._setStyles(ctx);
|
this._setStyles(ctx, param, viewMatrix);
|
||||||
if (hasFill) {
|
if (hasFill) {
|
||||||
ctx.fill(style.getFillRule());
|
ctx.fill(style.getFillRule());
|
||||||
ctx.shadowColor = 'rgba(0,0,0,0)';
|
ctx.shadowColor = 'rgba(0,0,0,0)';
|
||||||
|
@ -8442,7 +8447,7 @@ new function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
_draw: function(ctx, param, strokeMatrix) {
|
_draw: function(ctx, param, viewMatrix, strokeMatrix) {
|
||||||
var dontStart = param.dontStart,
|
var dontStart = param.dontStart,
|
||||||
dontPaint = param.dontFinish || param.clip,
|
dontPaint = param.dontFinish || param.clip,
|
||||||
style = this.getStyle(),
|
style = this.getStyle(),
|
||||||
|
@ -8466,7 +8471,7 @@ new function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dontPaint && (hasFill || hasStroke)) {
|
if (!dontPaint && (hasFill || hasStroke)) {
|
||||||
this._setStyles(ctx);
|
this._setStyles(ctx, param, viewMatrix);
|
||||||
if (hasFill) {
|
if (hasFill) {
|
||||||
ctx.fill(style.getFillRule());
|
ctx.fill(style.getFillRule());
|
||||||
ctx.shadowColor = 'rgba(0,0,0,0)';
|
ctx.shadowColor = 'rgba(0,0,0,0)';
|
||||||
|
@ -9193,7 +9198,7 @@ var CompoundPath = PathItem.extend({
|
||||||
viewMatrix);
|
viewMatrix);
|
||||||
},
|
},
|
||||||
|
|
||||||
_draw: function(ctx, param, strokeMatrix) {
|
_draw: function(ctx, param, viewMatrix, strokeMatrix) {
|
||||||
var children = this._children;
|
var children = this._children;
|
||||||
if (children.length === 0)
|
if (children.length === 0)
|
||||||
return;
|
return;
|
||||||
|
@ -9204,7 +9209,7 @@ var CompoundPath = PathItem.extend({
|
||||||
children[i].draw(ctx, param, strokeMatrix);
|
children[i].draw(ctx, param, strokeMatrix);
|
||||||
|
|
||||||
if (!param.clip) {
|
if (!param.clip) {
|
||||||
this._setStyles(ctx);
|
this._setStyles(ctx, param, viewMatrix);
|
||||||
var style = this._style;
|
var style = this._style;
|
||||||
if (style.hasFill()) {
|
if (style.hasFill()) {
|
||||||
ctx.fill(style.getFillRule());
|
ctx.fill(style.getFillRule());
|
||||||
|
@ -10325,10 +10330,10 @@ var PointText = TextItem.extend({
|
||||||
this.translate(point.subtract(this._matrix.getTranslation()));
|
this.translate(point.subtract(this._matrix.getTranslation()));
|
||||||
},
|
},
|
||||||
|
|
||||||
_draw: function(ctx) {
|
_draw: function(ctx, param, viewMatrix) {
|
||||||
if (!this._content)
|
if (!this._content)
|
||||||
return;
|
return;
|
||||||
this._setStyles(ctx);
|
this._setStyles(ctx, param, viewMatrix);
|
||||||
var lines = this._lines,
|
var lines = this._lines,
|
||||||
style = this._style,
|
style = this._style,
|
||||||
hasFill = style.hasFill(),
|
hasFill = style.hasFill(),
|
||||||
|
|
10
dist/paper-full.min.js
vendored
10
dist/paper-full.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue