Prebuilt module for commit 0e658da104

This commit is contained in:
Paper.js Bot 2016-03-16 19:51:37 +00:00
parent 8bdbfcdb5f
commit 9de778c97b
5 changed files with 276 additions and 234 deletions

View file

@ -9,7 +9,7 @@
* *
* All rights reserved. * All rights reserved.
* *
* Date: Wed Mar 16 09:56:10 2016 +0100 * Date: Wed Mar 16 20:47:57 2016 +0100
* *
*** ***
* *
@ -11100,7 +11100,7 @@ var GradientStop = Base.extend({
}); });
var Style = Base.extend(new function() { var Style = Base.extend(new function() {
var defaults = { var itemDefaults = {
fillColor: null, fillColor: null,
fillRule: 'nonzero', fillRule: 'nonzero',
strokeColor: null, strokeColor: null,
@ -11116,14 +11116,16 @@ var Style = Base.extend(new function() {
shadowOffset: new Point(), shadowOffset: new Point(),
selectedColor: null selectedColor: null
}, },
textDefaults = Base.set({}, defaults, { groupDefaults = Base.set({}, itemDefaults, {
fillColor: new Color(),
fontFamily: 'sans-serif', fontFamily: 'sans-serif',
fontWeight: 'normal', fontWeight: 'normal',
fontSize: 12, fontSize: 12,
leading: null, leading: null,
justification: 'left' justification: 'left'
}), }),
textDefaults = Base.set({}, groupDefaults, {
fillColor: new Color()
}),
flags = { flags = {
strokeWidth: 97, strokeWidth: 97,
strokeCap: 97, strokeCap: 97,
@ -11142,22 +11144,21 @@ var Style = Base.extend(new function() {
}, },
fields = { fields = {
_class: 'Style', _class: 'Style',
beans: true,
initialize: function Style(style, owner, project) { initialize: function Style(style, owner, project) {
this._values = {}; this._values = {};
this._owner = owner; this._owner = owner;
this._project = owner && owner._project || project || paper.project; this._project = owner && owner._project || project || paper.project;
if (owner instanceof TextItem) this._defaults = !owner || owner instanceof Group ? groupDefaults
this._defaults = textDefaults; : owner instanceof TextItem ? textDefaults
: itemDefaults;
if (style) if (style)
this.set(style); this.set(style);
}, }
_defaults: defaults,
beans: true
}; };
Base.each(textDefaults, function(value, key) { Base.each(groupDefaults, function(value, key) {
var isColor = /Color$/.test(key), var isColor = /Color$/.test(key),
isPoint = key === 'shadowOffset', isPoint = key === 'shadowOffset',
part = Base.capitalize(key), part = Base.capitalize(key),
@ -13548,7 +13549,7 @@ new function() {
var childNode = nodes[i], var childNode = nodes[i],
child; child;
if (childNode.nodeType === 1 if (childNode.nodeType === 1
&& childNode.nodeName.toLowerCase() !== 'defs' && !/^defs$/i.test(childNode.nodeName)
&& (child = importNode(childNode, options, false)) && (child = importNode(childNode, options, false))
&& !(child instanceof SymbolDefinition)) && !(child instanceof SymbolDefinition))
children.push(child); children.push(child);
@ -13703,6 +13704,7 @@ new function() {
}; };
function applyTransform(item, value, name, node) { function applyTransform(item, value, name, node) {
if (item.transform) {
var transforms = (node.getAttribute(name) || '').split(/\)\s*/g), var transforms = (node.getAttribute(name) || '').split(/\)\s*/g),
matrix = new Matrix(); matrix = new Matrix();
for (var i = 0, l = transforms.length; i < l; i++) { for (var i = 0, l = transforms.length; i < l; i++) {
@ -13716,7 +13718,8 @@ new function() {
v[j] = parseFloat(v[j]); v[j] = parseFloat(v[j]);
switch (command) { switch (command) {
case 'matrix': case 'matrix':
matrix.append(new Matrix(v[0], v[1], v[2], v[3], v[4], v[5])); matrix.append(
new Matrix(v[0], v[1], v[2], v[3], v[4], v[5]));
break; break;
case 'rotate': case 'rotate':
matrix.rotate(v[0], v[1], v[2]); matrix.rotate(v[0], v[1], v[2]);
@ -13737,16 +13740,18 @@ new function() {
} }
item.transform(matrix); item.transform(matrix);
} }
}
function applyOpacity(item, value, name) { function applyOpacity(item, value, name) {
var color = item[name === 'fill-opacity' ? 'getFillColor' var key = name === 'fill-opacity' ? 'getFillColor' : 'getStrokeColor',
: 'getStrokeColor'](); color = item[key] && item[key]();
if (color) if (color)
color.setAlpha(parseFloat(value)); color.setAlpha(parseFloat(value));
} }
var attributes = Base.set(Base.each(SvgStyles, function(entry) { var attributes = Base.set(Base.each(SvgStyles, function(entry) {
this[entry.attribute] = function(item, value) { this[entry.attribute] = function(item, value) {
if (item[entry.set]) {
item[entry.set](convertValue(value, entry.type, entry.fromSVG)); item[entry.set](convertValue(value, entry.type, entry.fromSVG));
if (entry.type === 'color') { if (entry.type === 'color') {
var color = item[entry.get](); var color = item[entry.get]();
@ -13758,8 +13763,9 @@ new function() {
.scale(bounds.getSize())); .scale(bounds.getSize()));
} }
if (item instanceof Shape) { if (item instanceof Shape) {
color.transform(new Matrix() color.transform(new Matrix().translate(
.translate(item.getPosition(true).negate())); item.getPosition(true).negate()));
}
} }
} }
} }
@ -13791,10 +13797,12 @@ new function() {
'stroke-opacity': applyOpacity, 'stroke-opacity': applyOpacity,
visibility: function(item, value) { visibility: function(item, value) {
if (item.setVisible)
item.setVisible(value === 'visible'); item.setVisible(value === 'visible');
}, },
display: function(item, value) { display: function(item, value) {
if (item.setVisible)
item.setVisible(value !== null); item.setVisible(value !== null);
}, },
@ -13809,9 +13817,11 @@ new function() {
}, },
offset: function(item, value) { offset: function(item, value) {
if (item.setRampPoint) {
var percentage = value.match(/(.*)%$/); var percentage = value.match(/(.*)%$/);
item.setRampPoint(percentage ? percentage[1] / 100 item.setRampPoint(percentage ? percentage[1] / 100
: parseFloat(value)); : parseFloat(value));
}
}, },
viewBox: function(item, value, name, node, styles) { viewBox: function(item, value, name, node, styles) {
@ -13829,6 +13839,7 @@ new function() {
rect.setSize(size); rect.setSize(size);
group = item._item; group = item._item;
} }
if (group) {
if (getAttribute(node, 'overflow', styles) !== 'visible') { if (getAttribute(node, 'overflow', styles) !== 'visible') {
var clip = new Shape.Rectangle(rect); var clip = new Shape.Rectangle(rect);
clip.setClipMask(true); clip.setClipMask(true);
@ -13837,6 +13848,7 @@ new function() {
if (matrix) if (matrix)
group.transform(matrix); group.transform(matrix);
} }
}
}); });
function getAttribute(node, name, styles) { function getAttribute(node, name, styles) {
@ -13854,14 +13866,16 @@ new function() {
} }
function applyAttributes(item, node, isRoot) { function applyAttributes(item, node, isRoot) {
var styles = { var parent = node.parentNode,
styles = {
node: DomElement.getStyles(node) || {}, node: DomElement.getStyles(node) || {},
parent: !isRoot && DomElement.getStyles(node.parentNode) || {} parent: !isRoot && !/^defs$/i.test(parent.tagName)
&& DomElement.getStyles(parent) || {}
}; };
Base.each(attributes, function(apply, name) { Base.each(attributes, function(apply, name) {
var value = getAttribute(node, name, styles); var value = getAttribute(node, name, styles);
if (value !== undefined) item = value !== undefined && apply(item, value, name, node, styles)
item = Base.pick(apply(item, value, name, node, styles), item); || item;
}); });
return item; return item;
} }

56
dist/paper-core.js vendored
View file

@ -9,7 +9,7 @@
* *
* All rights reserved. * All rights reserved.
* *
* Date: Wed Mar 16 09:56:10 2016 +0100 * Date: Wed Mar 16 20:47:57 2016 +0100
* *
*** ***
* *
@ -11100,7 +11100,7 @@ var GradientStop = Base.extend({
}); });
var Style = Base.extend(new function() { var Style = Base.extend(new function() {
var defaults = { var itemDefaults = {
fillColor: null, fillColor: null,
fillRule: 'nonzero', fillRule: 'nonzero',
strokeColor: null, strokeColor: null,
@ -11116,14 +11116,16 @@ var Style = Base.extend(new function() {
shadowOffset: new Point(), shadowOffset: new Point(),
selectedColor: null selectedColor: null
}, },
textDefaults = Base.set({}, defaults, { groupDefaults = Base.set({}, itemDefaults, {
fillColor: new Color(),
fontFamily: 'sans-serif', fontFamily: 'sans-serif',
fontWeight: 'normal', fontWeight: 'normal',
fontSize: 12, fontSize: 12,
leading: null, leading: null,
justification: 'left' justification: 'left'
}), }),
textDefaults = Base.set({}, groupDefaults, {
fillColor: new Color()
}),
flags = { flags = {
strokeWidth: 97, strokeWidth: 97,
strokeCap: 97, strokeCap: 97,
@ -11142,22 +11144,21 @@ var Style = Base.extend(new function() {
}, },
fields = { fields = {
_class: 'Style', _class: 'Style',
beans: true,
initialize: function Style(style, owner, project) { initialize: function Style(style, owner, project) {
this._values = {}; this._values = {};
this._owner = owner; this._owner = owner;
this._project = owner && owner._project || project || paper.project; this._project = owner && owner._project || project || paper.project;
if (owner instanceof TextItem) this._defaults = !owner || owner instanceof Group ? groupDefaults
this._defaults = textDefaults; : owner instanceof TextItem ? textDefaults
: itemDefaults;
if (style) if (style)
this.set(style); this.set(style);
}, }
_defaults: defaults,
beans: true
}; };
Base.each(textDefaults, function(value, key) { Base.each(groupDefaults, function(value, key) {
var isColor = /Color$/.test(key), var isColor = /Color$/.test(key),
isPoint = key === 'shadowOffset', isPoint = key === 'shadowOffset',
part = Base.capitalize(key), part = Base.capitalize(key),
@ -13548,7 +13549,7 @@ new function() {
var childNode = nodes[i], var childNode = nodes[i],
child; child;
if (childNode.nodeType === 1 if (childNode.nodeType === 1
&& childNode.nodeName.toLowerCase() !== 'defs' && !/^defs$/i.test(childNode.nodeName)
&& (child = importNode(childNode, options, false)) && (child = importNode(childNode, options, false))
&& !(child instanceof SymbolDefinition)) && !(child instanceof SymbolDefinition))
children.push(child); children.push(child);
@ -13703,6 +13704,7 @@ new function() {
}; };
function applyTransform(item, value, name, node) { function applyTransform(item, value, name, node) {
if (item.transform) {
var transforms = (node.getAttribute(name) || '').split(/\)\s*/g), var transforms = (node.getAttribute(name) || '').split(/\)\s*/g),
matrix = new Matrix(); matrix = new Matrix();
for (var i = 0, l = transforms.length; i < l; i++) { for (var i = 0, l = transforms.length; i < l; i++) {
@ -13716,7 +13718,8 @@ new function() {
v[j] = parseFloat(v[j]); v[j] = parseFloat(v[j]);
switch (command) { switch (command) {
case 'matrix': case 'matrix':
matrix.append(new Matrix(v[0], v[1], v[2], v[3], v[4], v[5])); matrix.append(
new Matrix(v[0], v[1], v[2], v[3], v[4], v[5]));
break; break;
case 'rotate': case 'rotate':
matrix.rotate(v[0], v[1], v[2]); matrix.rotate(v[0], v[1], v[2]);
@ -13737,16 +13740,18 @@ new function() {
} }
item.transform(matrix); item.transform(matrix);
} }
}
function applyOpacity(item, value, name) { function applyOpacity(item, value, name) {
var color = item[name === 'fill-opacity' ? 'getFillColor' var key = name === 'fill-opacity' ? 'getFillColor' : 'getStrokeColor',
: 'getStrokeColor'](); color = item[key] && item[key]();
if (color) if (color)
color.setAlpha(parseFloat(value)); color.setAlpha(parseFloat(value));
} }
var attributes = Base.set(Base.each(SvgStyles, function(entry) { var attributes = Base.set(Base.each(SvgStyles, function(entry) {
this[entry.attribute] = function(item, value) { this[entry.attribute] = function(item, value) {
if (item[entry.set]) {
item[entry.set](convertValue(value, entry.type, entry.fromSVG)); item[entry.set](convertValue(value, entry.type, entry.fromSVG));
if (entry.type === 'color') { if (entry.type === 'color') {
var color = item[entry.get](); var color = item[entry.get]();
@ -13758,8 +13763,9 @@ new function() {
.scale(bounds.getSize())); .scale(bounds.getSize()));
} }
if (item instanceof Shape) { if (item instanceof Shape) {
color.transform(new Matrix() color.transform(new Matrix().translate(
.translate(item.getPosition(true).negate())); item.getPosition(true).negate()));
}
} }
} }
} }
@ -13791,10 +13797,12 @@ new function() {
'stroke-opacity': applyOpacity, 'stroke-opacity': applyOpacity,
visibility: function(item, value) { visibility: function(item, value) {
if (item.setVisible)
item.setVisible(value === 'visible'); item.setVisible(value === 'visible');
}, },
display: function(item, value) { display: function(item, value) {
if (item.setVisible)
item.setVisible(value !== null); item.setVisible(value !== null);
}, },
@ -13809,9 +13817,11 @@ new function() {
}, },
offset: function(item, value) { offset: function(item, value) {
if (item.setRampPoint) {
var percentage = value.match(/(.*)%$/); var percentage = value.match(/(.*)%$/);
item.setRampPoint(percentage ? percentage[1] / 100 item.setRampPoint(percentage ? percentage[1] / 100
: parseFloat(value)); : parseFloat(value));
}
}, },
viewBox: function(item, value, name, node, styles) { viewBox: function(item, value, name, node, styles) {
@ -13829,6 +13839,7 @@ new function() {
rect.setSize(size); rect.setSize(size);
group = item._item; group = item._item;
} }
if (group) {
if (getAttribute(node, 'overflow', styles) !== 'visible') { if (getAttribute(node, 'overflow', styles) !== 'visible') {
var clip = new Shape.Rectangle(rect); var clip = new Shape.Rectangle(rect);
clip.setClipMask(true); clip.setClipMask(true);
@ -13837,6 +13848,7 @@ new function() {
if (matrix) if (matrix)
group.transform(matrix); group.transform(matrix);
} }
}
}); });
function getAttribute(node, name, styles) { function getAttribute(node, name, styles) {
@ -13854,14 +13866,16 @@ new function() {
} }
function applyAttributes(item, node, isRoot) { function applyAttributes(item, node, isRoot) {
var styles = { var parent = node.parentNode,
styles = {
node: DomElement.getStyles(node) || {}, node: DomElement.getStyles(node) || {},
parent: !isRoot && DomElement.getStyles(node.parentNode) || {} parent: !isRoot && !/^defs$/i.test(parent.tagName)
&& DomElement.getStyles(parent) || {}
}; };
Base.each(attributes, function(apply, name) { Base.each(attributes, function(apply, name) {
var value = getAttribute(node, name, styles); var value = getAttribute(node, name, styles);
if (value !== undefined) item = value !== undefined && apply(item, value, name, node, styles)
item = Base.pick(apply(item, value, name, node, styles), item); || item;
}); });
return item; return item;
} }

File diff suppressed because one or more lines are too long

56
dist/paper-full.js vendored
View file

@ -9,7 +9,7 @@
* *
* All rights reserved. * All rights reserved.
* *
* Date: Wed Mar 16 09:56:10 2016 +0100 * Date: Wed Mar 16 20:47:57 2016 +0100
* *
*** ***
* *
@ -11100,7 +11100,7 @@ var GradientStop = Base.extend({
}); });
var Style = Base.extend(new function() { var Style = Base.extend(new function() {
var defaults = { var itemDefaults = {
fillColor: null, fillColor: null,
fillRule: 'nonzero', fillRule: 'nonzero',
strokeColor: null, strokeColor: null,
@ -11116,14 +11116,16 @@ var Style = Base.extend(new function() {
shadowOffset: new Point(), shadowOffset: new Point(),
selectedColor: null selectedColor: null
}, },
textDefaults = Base.set({}, defaults, { groupDefaults = Base.set({}, itemDefaults, {
fillColor: new Color(),
fontFamily: 'sans-serif', fontFamily: 'sans-serif',
fontWeight: 'normal', fontWeight: 'normal',
fontSize: 12, fontSize: 12,
leading: null, leading: null,
justification: 'left' justification: 'left'
}), }),
textDefaults = Base.set({}, groupDefaults, {
fillColor: new Color()
}),
flags = { flags = {
strokeWidth: 97, strokeWidth: 97,
strokeCap: 97, strokeCap: 97,
@ -11142,22 +11144,21 @@ var Style = Base.extend(new function() {
}, },
fields = { fields = {
_class: 'Style', _class: 'Style',
beans: true,
initialize: function Style(style, owner, project) { initialize: function Style(style, owner, project) {
this._values = {}; this._values = {};
this._owner = owner; this._owner = owner;
this._project = owner && owner._project || project || paper.project; this._project = owner && owner._project || project || paper.project;
if (owner instanceof TextItem) this._defaults = !owner || owner instanceof Group ? groupDefaults
this._defaults = textDefaults; : owner instanceof TextItem ? textDefaults
: itemDefaults;
if (style) if (style)
this.set(style); this.set(style);
}, }
_defaults: defaults,
beans: true
}; };
Base.each(textDefaults, function(value, key) { Base.each(groupDefaults, function(value, key) {
var isColor = /Color$/.test(key), var isColor = /Color$/.test(key),
isPoint = key === 'shadowOffset', isPoint = key === 'shadowOffset',
part = Base.capitalize(key), part = Base.capitalize(key),
@ -13548,7 +13549,7 @@ new function() {
var childNode = nodes[i], var childNode = nodes[i],
child; child;
if (childNode.nodeType === 1 if (childNode.nodeType === 1
&& childNode.nodeName.toLowerCase() !== 'defs' && !/^defs$/i.test(childNode.nodeName)
&& (child = importNode(childNode, options, false)) && (child = importNode(childNode, options, false))
&& !(child instanceof SymbolDefinition)) && !(child instanceof SymbolDefinition))
children.push(child); children.push(child);
@ -13703,6 +13704,7 @@ new function() {
}; };
function applyTransform(item, value, name, node) { function applyTransform(item, value, name, node) {
if (item.transform) {
var transforms = (node.getAttribute(name) || '').split(/\)\s*/g), var transforms = (node.getAttribute(name) || '').split(/\)\s*/g),
matrix = new Matrix(); matrix = new Matrix();
for (var i = 0, l = transforms.length; i < l; i++) { for (var i = 0, l = transforms.length; i < l; i++) {
@ -13716,7 +13718,8 @@ new function() {
v[j] = parseFloat(v[j]); v[j] = parseFloat(v[j]);
switch (command) { switch (command) {
case 'matrix': case 'matrix':
matrix.append(new Matrix(v[0], v[1], v[2], v[3], v[4], v[5])); matrix.append(
new Matrix(v[0], v[1], v[2], v[3], v[4], v[5]));
break; break;
case 'rotate': case 'rotate':
matrix.rotate(v[0], v[1], v[2]); matrix.rotate(v[0], v[1], v[2]);
@ -13737,16 +13740,18 @@ new function() {
} }
item.transform(matrix); item.transform(matrix);
} }
}
function applyOpacity(item, value, name) { function applyOpacity(item, value, name) {
var color = item[name === 'fill-opacity' ? 'getFillColor' var key = name === 'fill-opacity' ? 'getFillColor' : 'getStrokeColor',
: 'getStrokeColor'](); color = item[key] && item[key]();
if (color) if (color)
color.setAlpha(parseFloat(value)); color.setAlpha(parseFloat(value));
} }
var attributes = Base.set(Base.each(SvgStyles, function(entry) { var attributes = Base.set(Base.each(SvgStyles, function(entry) {
this[entry.attribute] = function(item, value) { this[entry.attribute] = function(item, value) {
if (item[entry.set]) {
item[entry.set](convertValue(value, entry.type, entry.fromSVG)); item[entry.set](convertValue(value, entry.type, entry.fromSVG));
if (entry.type === 'color') { if (entry.type === 'color') {
var color = item[entry.get](); var color = item[entry.get]();
@ -13758,8 +13763,9 @@ new function() {
.scale(bounds.getSize())); .scale(bounds.getSize()));
} }
if (item instanceof Shape) { if (item instanceof Shape) {
color.transform(new Matrix() color.transform(new Matrix().translate(
.translate(item.getPosition(true).negate())); item.getPosition(true).negate()));
}
} }
} }
} }
@ -13791,10 +13797,12 @@ new function() {
'stroke-opacity': applyOpacity, 'stroke-opacity': applyOpacity,
visibility: function(item, value) { visibility: function(item, value) {
if (item.setVisible)
item.setVisible(value === 'visible'); item.setVisible(value === 'visible');
}, },
display: function(item, value) { display: function(item, value) {
if (item.setVisible)
item.setVisible(value !== null); item.setVisible(value !== null);
}, },
@ -13809,9 +13817,11 @@ new function() {
}, },
offset: function(item, value) { offset: function(item, value) {
if (item.setRampPoint) {
var percentage = value.match(/(.*)%$/); var percentage = value.match(/(.*)%$/);
item.setRampPoint(percentage ? percentage[1] / 100 item.setRampPoint(percentage ? percentage[1] / 100
: parseFloat(value)); : parseFloat(value));
}
}, },
viewBox: function(item, value, name, node, styles) { viewBox: function(item, value, name, node, styles) {
@ -13829,6 +13839,7 @@ new function() {
rect.setSize(size); rect.setSize(size);
group = item._item; group = item._item;
} }
if (group) {
if (getAttribute(node, 'overflow', styles) !== 'visible') { if (getAttribute(node, 'overflow', styles) !== 'visible') {
var clip = new Shape.Rectangle(rect); var clip = new Shape.Rectangle(rect);
clip.setClipMask(true); clip.setClipMask(true);
@ -13837,6 +13848,7 @@ new function() {
if (matrix) if (matrix)
group.transform(matrix); group.transform(matrix);
} }
}
}); });
function getAttribute(node, name, styles) { function getAttribute(node, name, styles) {
@ -13854,14 +13866,16 @@ new function() {
} }
function applyAttributes(item, node, isRoot) { function applyAttributes(item, node, isRoot) {
var styles = { var parent = node.parentNode,
styles = {
node: DomElement.getStyles(node) || {}, node: DomElement.getStyles(node) || {},
parent: !isRoot && DomElement.getStyles(node.parentNode) || {} parent: !isRoot && !/^defs$/i.test(parent.tagName)
&& DomElement.getStyles(parent) || {}
}; };
Base.each(attributes, function(apply, name) { Base.each(attributes, function(apply, name) {
var value = getAttribute(node, name, styles); var value = getAttribute(node, name, styles);
if (value !== undefined) item = value !== undefined && apply(item, value, name, node, styles)
item = Base.pick(apply(item, value, name, node, styles), item); || item;
}); });
return item; return item;
} }

File diff suppressed because one or more lines are too long