paper 0.12.17 → 0.12.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -1
- package/dist/docs/assets/js/paper.js +107 -61
- package/dist/docs/classes/Color.html +2 -2
- package/dist/docs/classes/CompoundPath.html +3 -4
- package/dist/docs/classes/Curve.html +2 -2
- package/dist/docs/classes/CurveLocation.html +2 -2
- package/dist/docs/classes/Event.html +2 -2
- package/dist/docs/classes/Gradient.html +2 -2
- package/dist/docs/classes/GradientStop.html +2 -2
- package/dist/docs/classes/Group.html +3 -4
- package/dist/docs/classes/HitResult.html +2 -2
- package/dist/docs/classes/Item.html +3 -4
- package/dist/docs/classes/Key.html +2 -2
- package/dist/docs/classes/KeyEvent.html +2 -2
- package/dist/docs/classes/Layer.html +3 -4
- package/dist/docs/classes/Matrix.html +2 -2
- package/dist/docs/classes/MouseEvent.html +2 -2
- package/dist/docs/classes/PaperScope.html +2 -2
- package/dist/docs/classes/PaperScript.html +2 -2
- package/dist/docs/classes/Path.html +3 -4
- package/dist/docs/classes/PathItem.html +3 -4
- package/dist/docs/classes/Point.html +2 -2
- package/dist/docs/classes/PointText.html +3 -4
- package/dist/docs/classes/Project.html +3 -2
- package/dist/docs/classes/Raster.html +3 -4
- package/dist/docs/classes/Rectangle.html +2 -2
- package/dist/docs/classes/Segment.html +2 -2
- package/dist/docs/classes/Shape.html +3 -4
- package/dist/docs/classes/Size.html +2 -2
- package/dist/docs/classes/Style.html +2 -2
- package/dist/docs/classes/SymbolDefinition.html +2 -2
- package/dist/docs/classes/SymbolItem.html +3 -4
- package/dist/docs/classes/TextItem.html +3 -4
- package/dist/docs/classes/Tool.html +2 -2
- package/dist/docs/classes/ToolEvent.html +2 -2
- package/dist/docs/classes/Tween.html +2 -2
- package/dist/docs/classes/View.html +3 -3
- package/dist/docs/classes/global.html +2 -2
- package/dist/docs/classes/index.html +2 -2
- package/dist/docs/index.html +1 -1
- package/dist/paper-core.js +106 -60
- package/dist/paper-core.min.js +3 -3
- package/dist/paper-full.js +107 -61
- package/dist/paper-full.min.js +3 -3
- package/dist/paper.d.ts +10 -4
- package/package.json +8 -5
package/dist/paper-full.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Paper.js v0.12.
|
|
2
|
+
* Paper.js v0.12.19 - The Swiss Army Knife of Vector Graphics Scripting.
|
|
3
3
|
* http://paperjs.org/
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2011 - 2020, Jürg Lehni & Jonathan Puckey
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* All rights reserved.
|
|
11
11
|
*
|
|
12
|
-
* Date:
|
|
12
|
+
* Date: Sun Oct 18 13:05:31 2026 +0200
|
|
13
13
|
*
|
|
14
14
|
***
|
|
15
15
|
*
|
|
@@ -821,7 +821,7 @@ var PaperScope = Base.extend({
|
|
|
821
821
|
}
|
|
822
822
|
},
|
|
823
823
|
|
|
824
|
-
version: "0.12.
|
|
824
|
+
version: "0.12.19",
|
|
825
825
|
|
|
826
826
|
getView: function() {
|
|
827
827
|
var project = this.project;
|
|
@@ -1919,7 +1919,9 @@ var Rectangle = Base.extend({
|
|
|
1919
1919
|
} else if (type === 'undefined' || arg0 === null) {
|
|
1920
1920
|
this._set(0, 0, 0, 0);
|
|
1921
1921
|
read = arg0 === null ? 1 : 0;
|
|
1922
|
-
} else if (args.length === 1
|
|
1922
|
+
} else if (args.length === 1
|
|
1923
|
+
|| Array.isArray(arg0) && arg0.length === 4
|
|
1924
|
+
|| arg0.x !== undefined && arg0.width !== undefined) {
|
|
1923
1925
|
if (Array.isArray(arg0)) {
|
|
1924
1926
|
this._set.apply(this, arg0);
|
|
1925
1927
|
read = 1;
|
|
@@ -3819,6 +3821,15 @@ new function() {
|
|
|
3819
3821
|
return this._index;
|
|
3820
3822
|
},
|
|
3821
3823
|
|
|
3824
|
+
setIndex: function(index) {
|
|
3825
|
+
var parent = this._parent,
|
|
3826
|
+
children = parent && parent._children;
|
|
3827
|
+
if (children) {
|
|
3828
|
+
parent.insertChildren(index in children ? index : undefined,
|
|
3829
|
+
[this]);
|
|
3830
|
+
}
|
|
3831
|
+
},
|
|
3832
|
+
|
|
3822
3833
|
equals: function(item) {
|
|
3823
3834
|
return item === this || item && this._class === item._class
|
|
3824
3835
|
&& this._style.equals(item._style)
|
|
@@ -4638,6 +4649,7 @@ new function() {
|
|
|
4638
4649
|
|
|
4639
4650
|
fitBounds: function(rectangle, fill) {
|
|
4640
4651
|
rectangle = Rectangle.read(arguments);
|
|
4652
|
+
fill = Base.read(arguments);
|
|
4641
4653
|
var bounds = this.getBounds(),
|
|
4642
4654
|
itemRatio = bounds.height / bounds.width,
|
|
4643
4655
|
rectRatio = rectangle.height / rectangle.width,
|
|
@@ -5093,7 +5105,11 @@ var Shape = Item.extend({
|
|
|
5093
5105
|
return;
|
|
5094
5106
|
var size = radius * 2;
|
|
5095
5107
|
this._radius = radius;
|
|
5096
|
-
this._size
|
|
5108
|
+
if (this._size) {
|
|
5109
|
+
this._size._set(size, size);
|
|
5110
|
+
} else {
|
|
5111
|
+
this._size = new Size(size, size);
|
|
5112
|
+
}
|
|
5097
5113
|
} else {
|
|
5098
5114
|
radius = Size.read(arguments);
|
|
5099
5115
|
if (!this._radius) {
|
|
@@ -5370,7 +5386,7 @@ var Raster = Item.extend({
|
|
|
5370
5386
|
|
|
5371
5387
|
initialize: function Raster(source, position) {
|
|
5372
5388
|
if (!this._initialize(source,
|
|
5373
|
-
position !== undefined && Point.read(
|
|
5389
|
+
position !== undefined && Point.read([position]))) {
|
|
5374
5390
|
var image,
|
|
5375
5391
|
type = typeof source,
|
|
5376
5392
|
object = type === 'string'
|
|
@@ -10077,12 +10093,10 @@ Path.inject({ statics: new function() {
|
|
|
10077
10093
|
from = Point.readNamed(args, 'from'),
|
|
10078
10094
|
through = Point.readNamed(args, 'through'),
|
|
10079
10095
|
to = Point.readNamed(args, 'to'),
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
|
|
10083
|
-
|
|
10084
|
-
path.arcTo(through, to);
|
|
10085
|
-
return path.set(props);
|
|
10096
|
+
arc = new Path(Item.NO_INSERT);
|
|
10097
|
+
arc.moveTo(from);
|
|
10098
|
+
arc.arcTo(through, to);
|
|
10099
|
+
return createPath(arc._segments, false, args);
|
|
10086
10100
|
},
|
|
10087
10101
|
|
|
10088
10102
|
RegularPolygon: function() {
|
|
@@ -13102,7 +13116,7 @@ var View = Base.extend(Emitter, {
|
|
|
13102
13116
|
pixels = parseFloat(DomElement.getStyles(temp).fontSize);
|
|
13103
13117
|
parent.removeChild(temp);
|
|
13104
13118
|
} else {
|
|
13105
|
-
pixels = parseFloat(
|
|
13119
|
+
pixels = parseFloat(size);
|
|
13106
13120
|
}
|
|
13107
13121
|
return pixels;
|
|
13108
13122
|
},
|
|
@@ -13926,8 +13940,8 @@ var ToolEvent = Event.extend({
|
|
|
13926
13940
|
},
|
|
13927
13941
|
|
|
13928
13942
|
setCount: function(count) {
|
|
13929
|
-
this.tool[/^mouse(down|up)$/.test(this.type)
|
|
13930
|
-
|
|
13943
|
+
this.tool[/^mouse(down|up)$/.test(this.type)
|
|
13944
|
+
? '_downCount' : '_moveCount'] = count;
|
|
13931
13945
|
},
|
|
13932
13946
|
|
|
13933
13947
|
getItem: function() {
|
|
@@ -14013,8 +14027,6 @@ var Tool = PaperScopeItem.extend({
|
|
|
14013
14027
|
type = 'mousemove';
|
|
14014
14028
|
var move = mouse.move || mouse.drag,
|
|
14015
14029
|
responds = this.responds(type),
|
|
14016
|
-
minDistance = this.minDistance,
|
|
14017
|
-
maxDistance = this.maxDistance,
|
|
14018
14030
|
called = false,
|
|
14019
14031
|
tool = this;
|
|
14020
14032
|
function update(minDistance, maxDistance) {
|
|
@@ -14057,10 +14069,10 @@ var Tool = PaperScopeItem.extend({
|
|
|
14057
14069
|
update();
|
|
14058
14070
|
emit();
|
|
14059
14071
|
} else if (mouse.up) {
|
|
14060
|
-
update(null,
|
|
14072
|
+
update(null, this._maxDistance);
|
|
14061
14073
|
emit();
|
|
14062
14074
|
} else if (responds) {
|
|
14063
|
-
while (update(
|
|
14075
|
+
while (update(this._minDistance, this._maxDistance))
|
|
14064
14076
|
emit();
|
|
14065
14077
|
}
|
|
14066
14078
|
return called;
|
|
@@ -14194,8 +14206,8 @@ var Tween = Base.extend(Emitter, {
|
|
|
14194
14206
|
var key = keys[i],
|
|
14195
14207
|
from = getValue(this._from[key]),
|
|
14196
14208
|
to = getValue(this._to[key]),
|
|
14197
|
-
value = (from && to && from.
|
|
14198
|
-
? to.
|
|
14209
|
+
value = (from && to && from.multiply && to.multiply)
|
|
14210
|
+
? to.subtract(from).multiply(factor).add(from)
|
|
14199
14211
|
: ((to - from) * factor) + from;
|
|
14200
14212
|
this._setProperty(this._parsedKeys[key], value);
|
|
14201
14213
|
}
|
|
@@ -14276,7 +14288,16 @@ var Tween = Base.extend(Emitter, {
|
|
|
14276
14288
|
},
|
|
14277
14289
|
|
|
14278
14290
|
_calculate: function(left, operator, right) {
|
|
14279
|
-
|
|
14291
|
+
var name = { '+': 'add', '-': 'subtract', '*': 'multiply',
|
|
14292
|
+
'/': 'divide' }[operator];
|
|
14293
|
+
if (left && left[name])
|
|
14294
|
+
return left[name](right);
|
|
14295
|
+
switch (operator) {
|
|
14296
|
+
case '+': return left + right;
|
|
14297
|
+
case '-': return left - right;
|
|
14298
|
+
case '*': return left * right;
|
|
14299
|
+
case '/': return left / right;
|
|
14300
|
+
}
|
|
14280
14301
|
},
|
|
14281
14302
|
|
|
14282
14303
|
_parseKeys: function(keys) {
|
|
@@ -14975,7 +14996,7 @@ new function() {
|
|
|
14975
14996
|
PointText: exportText
|
|
14976
14997
|
};
|
|
14977
14998
|
|
|
14978
|
-
function applyStyle(item, node, isRoot) {
|
|
14999
|
+
function applyStyle(item, node, options, isRoot) {
|
|
14979
15000
|
var attrs = {},
|
|
14980
15001
|
parent = !isRoot && item.getParent(),
|
|
14981
15002
|
style = [];
|
|
@@ -14989,7 +15010,8 @@ new function() {
|
|
|
14989
15010
|
value = item[get]();
|
|
14990
15011
|
if (entry.exportFilter
|
|
14991
15012
|
? entry.exportFilter(item, value)
|
|
14992
|
-
:
|
|
15013
|
+
: options.reduceAttributes == false
|
|
15014
|
+
|| !parent || !Base.equals(parent[get](), value)) {
|
|
14993
15015
|
if (type === 'color' && value != null) {
|
|
14994
15016
|
var alpha = value.getAlpha();
|
|
14995
15017
|
if (alpha < 1)
|
|
@@ -15071,7 +15093,7 @@ new function() {
|
|
|
15071
15093
|
if (data && data !== '{}' && data !== 'null')
|
|
15072
15094
|
node.setAttribute('data-paper-data', data);
|
|
15073
15095
|
}
|
|
15074
|
-
return node && applyStyle(item, node, isRoot);
|
|
15096
|
+
return node && applyStyle(item, node, options, isRoot);
|
|
15075
15097
|
}
|
|
15076
15098
|
|
|
15077
15099
|
function setOptions(options) {
|
|
@@ -15361,7 +15383,7 @@ new function() {
|
|
|
15361
15383
|
if (!transform)
|
|
15362
15384
|
break;
|
|
15363
15385
|
var parts = transform.split(/\(\s*/),
|
|
15364
|
-
command = parts[0],
|
|
15386
|
+
command = parts[0].trim(),
|
|
15365
15387
|
v = parts[1].split(/[\s,]+/g);
|
|
15366
15388
|
for (var j = 0, m = v.length; j < m; j++)
|
|
15367
15389
|
v[j] = parseFloat(v[j]);
|
|
@@ -15537,10 +15559,27 @@ new function() {
|
|
|
15537
15559
|
return res;
|
|
15538
15560
|
}
|
|
15539
15561
|
|
|
15562
|
+
var sandbox;
|
|
15563
|
+
|
|
15564
|
+
function getSandbox() {
|
|
15565
|
+
if (!(sandbox && sandbox.contentDocument)) {
|
|
15566
|
+
sandbox = document.createElement('iframe');
|
|
15567
|
+
sandbox.setAttribute('sandbox', 'allow-same-origin');
|
|
15568
|
+
sandbox.style.cssText = 'position: absolute; visibility: hidden;'
|
|
15569
|
+
+ ' width: 0; height: 0; border: 0';
|
|
15570
|
+
document.body.appendChild(sandbox);
|
|
15571
|
+
var doc = sandbox.contentDocument,
|
|
15572
|
+
meta = doc.createElement('meta');
|
|
15573
|
+
meta.httpEquiv = 'Content-Security-Policy';
|
|
15574
|
+
meta.content = "default-src 'none'; style-src 'unsafe-inline'";
|
|
15575
|
+
doc.head.appendChild(meta);
|
|
15576
|
+
}
|
|
15577
|
+
return sandbox.contentDocument.body;
|
|
15578
|
+
}
|
|
15579
|
+
|
|
15540
15580
|
function importNode(node, options, isRoot) {
|
|
15541
15581
|
var type = node.nodeName.toLowerCase(),
|
|
15542
15582
|
isElement = type !== '#document',
|
|
15543
|
-
body = document.body,
|
|
15544
15583
|
container,
|
|
15545
15584
|
parent,
|
|
15546
15585
|
next;
|
|
@@ -15553,46 +15592,53 @@ new function() {
|
|
|
15553
15592
|
parent = node.parentNode;
|
|
15554
15593
|
next = node.nextSibling;
|
|
15555
15594
|
container.appendChild(node);
|
|
15556
|
-
|
|
15595
|
+
getSandbox().appendChild(container);
|
|
15557
15596
|
}
|
|
15558
15597
|
var settings = paper.settings,
|
|
15559
15598
|
applyMatrix = settings.applyMatrix,
|
|
15560
|
-
insertItems = settings.insertItems
|
|
15561
|
-
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
|
|
15565
|
-
|
|
15566
|
-
|
|
15567
|
-
|
|
15568
|
-
|
|
15569
|
-
|
|
15570
|
-
|
|
15571
|
-
|
|
15572
|
-
|
|
15573
|
-
|
|
15574
|
-
|
|
15575
|
-
|
|
15576
|
-
|
|
15577
|
-
|
|
15578
|
-
|
|
15579
|
-
|
|
15580
|
-
|
|
15581
|
-
|
|
15582
|
-
|
|
15583
|
-
|
|
15584
|
-
if (
|
|
15585
|
-
|
|
15586
|
-
|
|
15587
|
-
|
|
15599
|
+
insertItems = settings.insertItems,
|
|
15600
|
+
item;
|
|
15601
|
+
try {
|
|
15602
|
+
settings.applyMatrix = false;
|
|
15603
|
+
settings.insertItems = false;
|
|
15604
|
+
try {
|
|
15605
|
+
var importer = importers[type];
|
|
15606
|
+
item = importer && importer(node, type, options, isRoot)
|
|
15607
|
+
|| null;
|
|
15608
|
+
} finally {
|
|
15609
|
+
settings.insertItems = insertItems;
|
|
15610
|
+
settings.applyMatrix = applyMatrix;
|
|
15611
|
+
}
|
|
15612
|
+
if (item) {
|
|
15613
|
+
if (isElement && !(item instanceof Group))
|
|
15614
|
+
item = applyAttributes(item, node, isRoot);
|
|
15615
|
+
var onImport = options.onImport,
|
|
15616
|
+
data = isElement && node.getAttribute('data-paper-data');
|
|
15617
|
+
if (onImport)
|
|
15618
|
+
item = onImport(node, item, options) || item;
|
|
15619
|
+
if (options.expandShapes && item instanceof Shape) {
|
|
15620
|
+
item.remove();
|
|
15621
|
+
item = item.toPath();
|
|
15622
|
+
}
|
|
15623
|
+
if (data)
|
|
15624
|
+
item._data = JSON.parse(data);
|
|
15625
|
+
}
|
|
15626
|
+
} finally {
|
|
15627
|
+
if (container) {
|
|
15628
|
+
container.parentNode.removeChild(container);
|
|
15629
|
+
if (parent) {
|
|
15630
|
+
if (next) {
|
|
15631
|
+
parent.insertBefore(node, next);
|
|
15632
|
+
} else {
|
|
15633
|
+
parent.appendChild(node);
|
|
15634
|
+
}
|
|
15588
15635
|
}
|
|
15589
15636
|
}
|
|
15637
|
+
if (isRoot)
|
|
15638
|
+
definitions = {};
|
|
15590
15639
|
}
|
|
15591
|
-
if (isRoot)
|
|
15592
|
-
|
|
15593
|
-
if (item && Base.pick(options.applyMatrix, applyMatrix))
|
|
15594
|
-
item.matrix.apply(true, true);
|
|
15595
|
-
}
|
|
15640
|
+
if (isRoot && item && Base.pick(options.applyMatrix, applyMatrix))
|
|
15641
|
+
item.matrix.apply(true, true);
|
|
15596
15642
|
return item;
|
|
15597
15643
|
}
|
|
15598
15644
|
|