Merge branch 'develop' into transform-support
This commit is contained in:
commit
f4f7562dd7
1300 changed files with 8845 additions and 10915 deletions
|
@ -192,7 +192,8 @@ Path.prototype.clean = function () {
|
|||
|
||||
if (ops.length < this.ops.length) this.ops = ops
|
||||
|
||||
return this
|
||||
// A path with not drawing operations or only a move is not path at all
|
||||
return ops.length === 0 || (ops.length === 1 && ops[0].type === 'move') ? false : this
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -490,7 +491,7 @@ Path.prototype.intersectsY = function (y) {
|
|||
Path.prototype.join = function (that, closed = false) {
|
||||
if (that instanceof Path !== true)
|
||||
this.log.error('Called `Path.join(that)` but `that` is not a `Path` object')
|
||||
return __joinPaths([this, that], closed, this.log)
|
||||
return __joinPaths([this, that], closed)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -572,7 +573,7 @@ Path.prototype.noop = function (id = false) {
|
|||
Path.prototype.offset = function (distance) {
|
||||
distance = __asNumber(distance, 'distance', 'Path.offset', this.log)
|
||||
|
||||
return __pathOffset(this, distance, this.log)
|
||||
return __pathOffset(this, distance)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -843,8 +844,8 @@ Path.prototype.split = function (point) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (firstHalf.length > 0) firstHalf = __joinPaths(firstHalf, false, this.log)
|
||||
if (secondHalf.length > 0) secondHalf = __joinPaths(secondHalf, false, this.log)
|
||||
if (firstHalf.length > 0) firstHalf = __joinPaths(firstHalf, false)
|
||||
if (secondHalf.length > 0) secondHalf = __joinPaths(secondHalf, false)
|
||||
|
||||
return [firstHalf, secondHalf]
|
||||
}
|
||||
|
@ -930,9 +931,9 @@ Path.prototype.trim = function () {
|
|||
first = false
|
||||
}
|
||||
let joint
|
||||
if (trimmedStart.length > 0) joint = __joinPaths(trimmedStart, false, this.log).join(glue)
|
||||
if (trimmedStart.length > 0) joint = __joinPaths(trimmedStart, false).join(glue)
|
||||
else joint = glue
|
||||
if (trimmedEnd.length > 0) joint = joint.join(__joinPaths(trimmedEnd, false, this.log))
|
||||
if (trimmedEnd.length > 0) joint = joint.join(__joinPaths(trimmedEnd, false))
|
||||
|
||||
return joint.trim()
|
||||
}
|
||||
|
@ -1280,10 +1281,9 @@ function __offsetLine(from, to, distance, log = false) {
|
|||
* @private
|
||||
* @param {Path} path - The Path to offset
|
||||
* @param {float} distance - The distance to offset by
|
||||
* @param {object} log - The log methods
|
||||
* @return {Path} offsetted - The offsetted Path instance
|
||||
*/
|
||||
function __pathOffset(path, distance, log) {
|
||||
function __pathOffset(path, distance) {
|
||||
let offset = []
|
||||
let current
|
||||
let start = false
|
||||
|
@ -1311,13 +1311,16 @@ function __pathOffset(path, distance, log) {
|
|||
{ x: cp2.x, y: cp2.y },
|
||||
{ x: op.to.x, y: op.to.y }
|
||||
)
|
||||
for (let bezier of b.offset(distance)) offset.push(__asPath(bezier, path.log))
|
||||
for (let bezier of b.offset(distance)) {
|
||||
const segment = __asPath(bezier, path.log)
|
||||
if (segment) offset.push(segment)
|
||||
}
|
||||
} else if (op.type === 'close') closed = true
|
||||
if (op.to) current = op.to
|
||||
if (!start) start = current
|
||||
}
|
||||
|
||||
return __joinPaths(offset, closed, log)
|
||||
return __joinPaths(offset, closed)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -220,7 +220,7 @@ Pattern.prototype.getRenderProps = function () {
|
|||
...set[p].asProps(),
|
||||
store: this.setStores[set[p].set],
|
||||
}
|
||||
} else if (this.setStores[set?.set]) {
|
||||
} else if (this.setStores[set.set]) {
|
||||
this.setStores[set.set].log.info(
|
||||
`Part${p} is hidden in set ${set.set}. Not adding to render props`
|
||||
)
|
||||
|
@ -387,7 +387,7 @@ Pattern.prototype.__applySettings = function (sets) {
|
|||
if (!Array.isArray(sets)) throw 'Sets should be an array of settings objects'
|
||||
if (sets.length === 0) sets.push({}) // Required to load default settings
|
||||
this.settings = []
|
||||
for (const i in sets) {
|
||||
for (let i = 0; i < sets.length; i++) {
|
||||
// Don't mutate the input itself
|
||||
const set = { ...sets[i] }
|
||||
if (!set.options) set.options = {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue