mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
parent
a43db8427a
commit
261fc02c1d
2 changed files with 26 additions and 23 deletions
|
@ -163,10 +163,10 @@ PathItem.inject(new function() {
|
||||||
var _path1 = preparePath(path1),
|
var _path1 = preparePath(path1),
|
||||||
_path2 = preparePath(path2),
|
_path2 = preparePath(path2),
|
||||||
crossings = _path1.getCrossings(_path2),
|
crossings = _path1.getCrossings(_path2),
|
||||||
added = {},
|
subtract = operation === 'subtract',
|
||||||
paths = [],
|
|
||||||
divide = operation === 'divide',
|
divide = operation === 'divide',
|
||||||
subtract = operation === 'subtract';
|
added = {},
|
||||||
|
paths = [];
|
||||||
|
|
||||||
function addPath(path) {
|
function addPath(path) {
|
||||||
// Simple see if the point halfway across the open path is inside
|
// Simple see if the point halfway across the open path is inside
|
||||||
|
|
|
@ -521,23 +521,25 @@ new function() {
|
||||||
* @param {Item} item the item to apply the style and attributes to
|
* @param {Item} item the item to apply the style and attributes to
|
||||||
*/
|
*/
|
||||||
function applyAttributes(item, node, isRoot) {
|
function applyAttributes(item, node, isRoot) {
|
||||||
// SVG attributes can be set both as styles and direct node attributes,
|
if (node.style) {
|
||||||
// so we need to handle both.
|
// SVG attributes can be set both as styles and direct node
|
||||||
var parent = node.parentNode,
|
// attributes, so we need to handle both.
|
||||||
styles = {
|
var parent = node.parentNode,
|
||||||
node: DomElement.getStyles(node) || {},
|
styles = {
|
||||||
// Do not check for inheritance if this is root, since we want
|
node: DomElement.getStyles(node) || {},
|
||||||
// the default SVG settings to stick. Also detect defs parents,
|
// Do not check for inheritance if this is root, to make the
|
||||||
// of which children need to explicitly inherit their styles.
|
// default SVG settings stick. Also detect defs parents, of
|
||||||
parent: !isRoot && !/^defs$/i.test(parent.tagName)
|
// which children need to explicitly inherit their styles.
|
||||||
&& DomElement.getStyles(parent) || {}
|
parent: !isRoot && !/^defs$/i.test(parent.tagName)
|
||||||
};
|
&& DomElement.getStyles(parent) || {}
|
||||||
Base.each(attributes, function(apply, name) {
|
};
|
||||||
var value = getAttribute(node, name, styles);
|
Base.each(attributes, function(apply, name) {
|
||||||
// 'clip-path' attribute returns a new item, support it here:
|
var value = getAttribute(node, name, styles);
|
||||||
item = value !== undefined && apply(item, value, name, node, styles)
|
// 'clip-path' attribute returns a new item, support it here:
|
||||||
|| item;
|
item = value !== undefined
|
||||||
});
|
&& apply(item, value, name, node, styles) || item;
|
||||||
|
});
|
||||||
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,9 +573,10 @@ new function() {
|
||||||
parent,
|
parent,
|
||||||
next;
|
next;
|
||||||
if (isRoot && isElement) {
|
if (isRoot && isElement) {
|
||||||
// Set rootSize root element size, fall-back to view size.
|
// Set rootSize to view size, as getSize() may refer to it (#1242).
|
||||||
rootSize = getSize(node, null, null, true)
|
rootSize = paper.getView().getSize();
|
||||||
|| paper.getView().getSize();
|
// Now set rootSize to the root element size, and fall-back to view.
|
||||||
|
rootSize = getSize(node, null, null, true) || rootSize;
|
||||||
// We need to move the SVG node to the current document, so default
|
// We need to move the SVG node to the current document, so default
|
||||||
// styles are correctly inherited! For this we create and insert a
|
// styles are correctly inherited! For this we create and insert a
|
||||||
// temporary SVG container which is removed again at the end. This
|
// temporary SVG container which is removed again at the end. This
|
||||||
|
|
Loading…
Reference in a new issue