mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 13:52:06 -05:00
Prebuilt module for commit d9e09b9d20
This commit is contained in:
parent
1dc637690a
commit
429e8e3d3a
5 changed files with 87 additions and 84 deletions
53
dist/docs/assets/js/paper.js
vendored
53
dist/docs/assets/js/paper.js
vendored
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Date: Wed Feb 10 18:13:13 2016 +0100
|
* Date: Wed Feb 10 18:23:56 2016 +0100
|
||||||
*
|
*
|
||||||
***
|
***
|
||||||
*
|
*
|
||||||
|
@ -13344,7 +13344,7 @@ new function() {
|
||||||
|
|
||||||
var rootSize;
|
var rootSize;
|
||||||
|
|
||||||
function getValue(node, name, isString, allowNull) {
|
function getValue(node, name, isString, allowNull, allowPercent) {
|
||||||
var value = SvgElement.get(node, name),
|
var value = SvgElement.get(node, name),
|
||||||
res = value == null
|
res = value == null
|
||||||
? allowNull
|
? allowNull
|
||||||
|
@ -13354,21 +13354,21 @@ new function() {
|
||||||
? value
|
? value
|
||||||
: parseFloat(value);
|
: parseFloat(value);
|
||||||
return /%\s*$/.test(value)
|
return /%\s*$/.test(value)
|
||||||
? (res / 100) * (rootSize ? rootSize[
|
? (res / 100) * (allowPercent ? 1
|
||||||
/x|^width/.test(name) ? 'width' : 'height'] : 1)
|
: rootSize[/x|^width/.test(name) ? 'width' : 'height'])
|
||||||
: res;
|
: res;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPoint(node, x, y, allowNull) {
|
function getPoint(node, x, y, allowNull, allowPercent) {
|
||||||
x = getValue(node, x || 'x', false, allowNull);
|
x = getValue(node, x || 'x', false, allowNull, allowPercent);
|
||||||
y = getValue(node, y || 'y', false, allowNull);
|
y = getValue(node, y || 'y', false, allowNull, allowPercent);
|
||||||
return allowNull && (x == null || y == null) ? null
|
return allowNull && (x == null || y == null) ? null
|
||||||
: new Point(x, y);
|
: new Point(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSize(node, w, h, allowNull) {
|
function getSize(node, w, h, allowNull, allowPercent) {
|
||||||
w = getValue(node, w || 'width', false, allowNull);
|
w = getValue(node, w || 'width', false, allowNull, allowPercent);
|
||||||
h = getValue(node, h || 'height', false, allowNull);
|
h = getValue(node, h || 'height', false, allowNull, allowPercent);
|
||||||
return allowNull && (w == null || h == null) ? null
|
return allowNull && (w == null || h == null) ? null
|
||||||
: new Size(w, h);
|
: new Size(w, h);
|
||||||
}
|
}
|
||||||
|
@ -13444,15 +13444,14 @@ new function() {
|
||||||
|
|
||||||
function importGradient(node, type) {
|
function importGradient(node, type) {
|
||||||
var id = (getValue(node, 'href', true) || '').substring(1),
|
var id = (getValue(node, 'href', true) || '').substring(1),
|
||||||
isRadial = type === 'radialgradient',
|
radial = type === 'radialgradient',
|
||||||
gradient,
|
gradient;
|
||||||
scaleToBounds = getValue(node, 'gradientUnits', true) !==
|
|
||||||
'userSpaceOnUse';
|
|
||||||
prevSize = rootSize;
|
|
||||||
if (scaleToBounds)
|
|
||||||
rootSize = null;
|
|
||||||
if (id) {
|
if (id) {
|
||||||
gradient = definitions[id].getGradient();
|
gradient = definitions[id].getGradient();
|
||||||
|
if (gradient._radial ^ radial) {
|
||||||
|
gradient = gradient.clone();
|
||||||
|
gradient._radial = radial;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
var nodes = node.childNodes,
|
var nodes = node.childNodes,
|
||||||
stops = [];
|
stops = [];
|
||||||
|
@ -13461,21 +13460,23 @@ new function() {
|
||||||
if (child.nodeType === 1)
|
if (child.nodeType === 1)
|
||||||
stops.push(applyAttributes(new GradientStop(), child));
|
stops.push(applyAttributes(new GradientStop(), child));
|
||||||
}
|
}
|
||||||
gradient = new Gradient(stops, isRadial);
|
gradient = new Gradient(stops, radial);
|
||||||
}
|
}
|
||||||
var origin, destination, highlight;
|
var origin, destination, highlight,
|
||||||
if (isRadial) {
|
scaleToBounds = getValue(node, 'gradientUnits', true) !==
|
||||||
origin = getPoint(node, 'cx', 'cy');
|
'userSpaceOnUse';
|
||||||
destination = origin.add(getValue(node, 'r'), 0);
|
if (radial) {
|
||||||
highlight = getPoint(node, 'fx', 'fy', true);
|
origin = getPoint(node, 'cx', 'cy', false, scaleToBounds);
|
||||||
|
destination = origin.add(
|
||||||
|
getValue(node, 'r', false, false, scaleToBounds), 0);
|
||||||
|
highlight = getPoint(node, 'fx', 'fy', true, scaleToBounds);
|
||||||
} else {
|
} else {
|
||||||
origin = getPoint(node, 'x1', 'y1');
|
origin = getPoint(node, 'x1', 'y1', false, scaleToBounds);
|
||||||
destination = getPoint(node, 'x2', 'y2');
|
destination = getPoint(node, 'x2', 'y2', false, scaleToBounds);
|
||||||
}
|
}
|
||||||
var color = applyAttributes(
|
var color = applyAttributes(
|
||||||
new Color(gradient, origin, destination, highlight), node);
|
new Color(gradient, origin, destination, highlight), node);
|
||||||
color._scaleToBounds = scaleToBounds;
|
color._scaleToBounds = scaleToBounds;
|
||||||
rootSize = prevSize;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
53
dist/paper-core.js
vendored
53
dist/paper-core.js
vendored
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Date: Wed Feb 10 18:13:13 2016 +0100
|
* Date: Wed Feb 10 18:23:56 2016 +0100
|
||||||
*
|
*
|
||||||
***
|
***
|
||||||
*
|
*
|
||||||
|
@ -13344,7 +13344,7 @@ new function() {
|
||||||
|
|
||||||
var rootSize;
|
var rootSize;
|
||||||
|
|
||||||
function getValue(node, name, isString, allowNull) {
|
function getValue(node, name, isString, allowNull, allowPercent) {
|
||||||
var value = SvgElement.get(node, name),
|
var value = SvgElement.get(node, name),
|
||||||
res = value == null
|
res = value == null
|
||||||
? allowNull
|
? allowNull
|
||||||
|
@ -13354,21 +13354,21 @@ new function() {
|
||||||
? value
|
? value
|
||||||
: parseFloat(value);
|
: parseFloat(value);
|
||||||
return /%\s*$/.test(value)
|
return /%\s*$/.test(value)
|
||||||
? (res / 100) * (rootSize ? rootSize[
|
? (res / 100) * (allowPercent ? 1
|
||||||
/x|^width/.test(name) ? 'width' : 'height'] : 1)
|
: rootSize[/x|^width/.test(name) ? 'width' : 'height'])
|
||||||
: res;
|
: res;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPoint(node, x, y, allowNull) {
|
function getPoint(node, x, y, allowNull, allowPercent) {
|
||||||
x = getValue(node, x || 'x', false, allowNull);
|
x = getValue(node, x || 'x', false, allowNull, allowPercent);
|
||||||
y = getValue(node, y || 'y', false, allowNull);
|
y = getValue(node, y || 'y', false, allowNull, allowPercent);
|
||||||
return allowNull && (x == null || y == null) ? null
|
return allowNull && (x == null || y == null) ? null
|
||||||
: new Point(x, y);
|
: new Point(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSize(node, w, h, allowNull) {
|
function getSize(node, w, h, allowNull, allowPercent) {
|
||||||
w = getValue(node, w || 'width', false, allowNull);
|
w = getValue(node, w || 'width', false, allowNull, allowPercent);
|
||||||
h = getValue(node, h || 'height', false, allowNull);
|
h = getValue(node, h || 'height', false, allowNull, allowPercent);
|
||||||
return allowNull && (w == null || h == null) ? null
|
return allowNull && (w == null || h == null) ? null
|
||||||
: new Size(w, h);
|
: new Size(w, h);
|
||||||
}
|
}
|
||||||
|
@ -13444,15 +13444,14 @@ new function() {
|
||||||
|
|
||||||
function importGradient(node, type) {
|
function importGradient(node, type) {
|
||||||
var id = (getValue(node, 'href', true) || '').substring(1),
|
var id = (getValue(node, 'href', true) || '').substring(1),
|
||||||
isRadial = type === 'radialgradient',
|
radial = type === 'radialgradient',
|
||||||
gradient,
|
gradient;
|
||||||
scaleToBounds = getValue(node, 'gradientUnits', true) !==
|
|
||||||
'userSpaceOnUse';
|
|
||||||
prevSize = rootSize;
|
|
||||||
if (scaleToBounds)
|
|
||||||
rootSize = null;
|
|
||||||
if (id) {
|
if (id) {
|
||||||
gradient = definitions[id].getGradient();
|
gradient = definitions[id].getGradient();
|
||||||
|
if (gradient._radial ^ radial) {
|
||||||
|
gradient = gradient.clone();
|
||||||
|
gradient._radial = radial;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
var nodes = node.childNodes,
|
var nodes = node.childNodes,
|
||||||
stops = [];
|
stops = [];
|
||||||
|
@ -13461,21 +13460,23 @@ new function() {
|
||||||
if (child.nodeType === 1)
|
if (child.nodeType === 1)
|
||||||
stops.push(applyAttributes(new GradientStop(), child));
|
stops.push(applyAttributes(new GradientStop(), child));
|
||||||
}
|
}
|
||||||
gradient = new Gradient(stops, isRadial);
|
gradient = new Gradient(stops, radial);
|
||||||
}
|
}
|
||||||
var origin, destination, highlight;
|
var origin, destination, highlight,
|
||||||
if (isRadial) {
|
scaleToBounds = getValue(node, 'gradientUnits', true) !==
|
||||||
origin = getPoint(node, 'cx', 'cy');
|
'userSpaceOnUse';
|
||||||
destination = origin.add(getValue(node, 'r'), 0);
|
if (radial) {
|
||||||
highlight = getPoint(node, 'fx', 'fy', true);
|
origin = getPoint(node, 'cx', 'cy', false, scaleToBounds);
|
||||||
|
destination = origin.add(
|
||||||
|
getValue(node, 'r', false, false, scaleToBounds), 0);
|
||||||
|
highlight = getPoint(node, 'fx', 'fy', true, scaleToBounds);
|
||||||
} else {
|
} else {
|
||||||
origin = getPoint(node, 'x1', 'y1');
|
origin = getPoint(node, 'x1', 'y1', false, scaleToBounds);
|
||||||
destination = getPoint(node, 'x2', 'y2');
|
destination = getPoint(node, 'x2', 'y2', false, scaleToBounds);
|
||||||
}
|
}
|
||||||
var color = applyAttributes(
|
var color = applyAttributes(
|
||||||
new Color(gradient, origin, destination, highlight), node);
|
new Color(gradient, origin, destination, highlight), node);
|
||||||
color._scaleToBounds = scaleToBounds;
|
color._scaleToBounds = scaleToBounds;
|
||||||
rootSize = prevSize;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
6
dist/paper-core.min.js
vendored
6
dist/paper-core.min.js
vendored
File diff suppressed because one or more lines are too long
53
dist/paper-full.js
vendored
53
dist/paper-full.js
vendored
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Date: Wed Feb 10 18:13:13 2016 +0100
|
* Date: Wed Feb 10 18:23:56 2016 +0100
|
||||||
*
|
*
|
||||||
***
|
***
|
||||||
*
|
*
|
||||||
|
@ -13344,7 +13344,7 @@ new function() {
|
||||||
|
|
||||||
var rootSize;
|
var rootSize;
|
||||||
|
|
||||||
function getValue(node, name, isString, allowNull) {
|
function getValue(node, name, isString, allowNull, allowPercent) {
|
||||||
var value = SvgElement.get(node, name),
|
var value = SvgElement.get(node, name),
|
||||||
res = value == null
|
res = value == null
|
||||||
? allowNull
|
? allowNull
|
||||||
|
@ -13354,21 +13354,21 @@ new function() {
|
||||||
? value
|
? value
|
||||||
: parseFloat(value);
|
: parseFloat(value);
|
||||||
return /%\s*$/.test(value)
|
return /%\s*$/.test(value)
|
||||||
? (res / 100) * (rootSize ? rootSize[
|
? (res / 100) * (allowPercent ? 1
|
||||||
/x|^width/.test(name) ? 'width' : 'height'] : 1)
|
: rootSize[/x|^width/.test(name) ? 'width' : 'height'])
|
||||||
: res;
|
: res;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPoint(node, x, y, allowNull) {
|
function getPoint(node, x, y, allowNull, allowPercent) {
|
||||||
x = getValue(node, x || 'x', false, allowNull);
|
x = getValue(node, x || 'x', false, allowNull, allowPercent);
|
||||||
y = getValue(node, y || 'y', false, allowNull);
|
y = getValue(node, y || 'y', false, allowNull, allowPercent);
|
||||||
return allowNull && (x == null || y == null) ? null
|
return allowNull && (x == null || y == null) ? null
|
||||||
: new Point(x, y);
|
: new Point(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSize(node, w, h, allowNull) {
|
function getSize(node, w, h, allowNull, allowPercent) {
|
||||||
w = getValue(node, w || 'width', false, allowNull);
|
w = getValue(node, w || 'width', false, allowNull, allowPercent);
|
||||||
h = getValue(node, h || 'height', false, allowNull);
|
h = getValue(node, h || 'height', false, allowNull, allowPercent);
|
||||||
return allowNull && (w == null || h == null) ? null
|
return allowNull && (w == null || h == null) ? null
|
||||||
: new Size(w, h);
|
: new Size(w, h);
|
||||||
}
|
}
|
||||||
|
@ -13444,15 +13444,14 @@ new function() {
|
||||||
|
|
||||||
function importGradient(node, type) {
|
function importGradient(node, type) {
|
||||||
var id = (getValue(node, 'href', true) || '').substring(1),
|
var id = (getValue(node, 'href', true) || '').substring(1),
|
||||||
isRadial = type === 'radialgradient',
|
radial = type === 'radialgradient',
|
||||||
gradient,
|
gradient;
|
||||||
scaleToBounds = getValue(node, 'gradientUnits', true) !==
|
|
||||||
'userSpaceOnUse';
|
|
||||||
prevSize = rootSize;
|
|
||||||
if (scaleToBounds)
|
|
||||||
rootSize = null;
|
|
||||||
if (id) {
|
if (id) {
|
||||||
gradient = definitions[id].getGradient();
|
gradient = definitions[id].getGradient();
|
||||||
|
if (gradient._radial ^ radial) {
|
||||||
|
gradient = gradient.clone();
|
||||||
|
gradient._radial = radial;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
var nodes = node.childNodes,
|
var nodes = node.childNodes,
|
||||||
stops = [];
|
stops = [];
|
||||||
|
@ -13461,21 +13460,23 @@ new function() {
|
||||||
if (child.nodeType === 1)
|
if (child.nodeType === 1)
|
||||||
stops.push(applyAttributes(new GradientStop(), child));
|
stops.push(applyAttributes(new GradientStop(), child));
|
||||||
}
|
}
|
||||||
gradient = new Gradient(stops, isRadial);
|
gradient = new Gradient(stops, radial);
|
||||||
}
|
}
|
||||||
var origin, destination, highlight;
|
var origin, destination, highlight,
|
||||||
if (isRadial) {
|
scaleToBounds = getValue(node, 'gradientUnits', true) !==
|
||||||
origin = getPoint(node, 'cx', 'cy');
|
'userSpaceOnUse';
|
||||||
destination = origin.add(getValue(node, 'r'), 0);
|
if (radial) {
|
||||||
highlight = getPoint(node, 'fx', 'fy', true);
|
origin = getPoint(node, 'cx', 'cy', false, scaleToBounds);
|
||||||
|
destination = origin.add(
|
||||||
|
getValue(node, 'r', false, false, scaleToBounds), 0);
|
||||||
|
highlight = getPoint(node, 'fx', 'fy', true, scaleToBounds);
|
||||||
} else {
|
} else {
|
||||||
origin = getPoint(node, 'x1', 'y1');
|
origin = getPoint(node, 'x1', 'y1', false, scaleToBounds);
|
||||||
destination = getPoint(node, 'x2', 'y2');
|
destination = getPoint(node, 'x2', 'y2', false, scaleToBounds);
|
||||||
}
|
}
|
||||||
var color = applyAttributes(
|
var color = applyAttributes(
|
||||||
new Color(gradient, origin, destination, highlight), node);
|
new Color(gradient, origin, destination, highlight), node);
|
||||||
color._scaleToBounds = scaleToBounds;
|
color._scaleToBounds = scaleToBounds;
|
||||||
rootSize = prevSize;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
6
dist/paper-full.min.js
vendored
6
dist/paper-full.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue