mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-03 23:55:04 +08:00
Large refactoring and new nodes
* Fix node reference when changing elements * Fix ScriptVariables parsing * Fix invariant text and niagara types * Niagara convert nodes * Move node tests to own files * More Niagara tests * Niagara float and smaller fixes * More Decoding * More decoding * WIP * Float is real * WIP * More types and colors * Test case and small polish * WIP * WIP * Fix niagara script variables merging * Fix Niagara variables * Fixing mirrored ExportPath * Fix Export paths name adjustments * Simplify arc calculation * Simplify a bit arc calculation * source / destionation => origin / target * Minor refactoring * Fix switched link position * Rename some properties for uniformity * Fix input escape * Simplify test * About window * Dialog backdrop style * About dialog touches * Remove dependency and minot improvement * Light mode * Fix link location and css small improvement * Link direction and minor fixes * Some minor fixes and refactoring * Refactoring WIP * Shorting repetitive bits * More tests * Simplify linking tests
This commit is contained in:
@@ -80,7 +80,7 @@ export default class Utility {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Attribute} entity
|
||||
* @param {IEntity} entity
|
||||
* @param {String} key
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
@@ -147,29 +147,31 @@ export default class Utility {
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @param {Array<T>} a
|
||||
* @param {Array<T>} b
|
||||
* @param {T[]} reference
|
||||
* @param {T[]} additional
|
||||
* @param {(v: T) => void} adding - Process added element
|
||||
* @param {(l: T, r: T) => Boolean} predicate
|
||||
* @returns {T[]}
|
||||
*/
|
||||
static mergeArrays(a = [], b = [], predicate = (l, r) => l == r) {
|
||||
static mergeArrays(reference = [], additional = [], predicate = (l, r) => l == r, adding = v => { }) {
|
||||
let result = []
|
||||
a = [...a]
|
||||
b = [...b]
|
||||
reference = [...reference]
|
||||
additional = [...additional]
|
||||
restart:
|
||||
while (true) {
|
||||
for (let j = 0; j < b.length; ++j) {
|
||||
for (let i = 0; i < a.length; ++i) {
|
||||
if (predicate(a[i], b[j])) {
|
||||
for (let j = 0; j < additional.length; ++j) {
|
||||
for (let i = 0; i < reference.length; ++i) {
|
||||
if (predicate(reference[i], additional[j])) {
|
||||
// Found an element in common in the two arrays
|
||||
result.push(
|
||||
// Take and append all the elements skipped from a
|
||||
...a.splice(0, i),
|
||||
...reference.splice(0, i),
|
||||
// Take and append all the elements skippend from b
|
||||
...b.splice(0, j),
|
||||
...additional.splice(0, j).map(v => (adding(v), v)),
|
||||
// Take and append the element in common
|
||||
...a.splice(0, 1)
|
||||
...reference.splice(0, 1)
|
||||
)
|
||||
b.shift() // Remove the same element from b
|
||||
additional.shift() // Remove the same element from b
|
||||
continue restart
|
||||
}
|
||||
}
|
||||
@@ -177,7 +179,13 @@ export default class Utility {
|
||||
break restart
|
||||
}
|
||||
// Append remaining the elements in the arrays and make it unique
|
||||
return [...(new Set(result.concat(...a, ...b)))]
|
||||
result.push(...reference)
|
||||
result.push(
|
||||
...additional
|
||||
.filter(vb => !result.some(vr => predicate(vr, vb)))
|
||||
.map((v, k) => (adding(v), v))
|
||||
)
|
||||
return result
|
||||
}
|
||||
|
||||
/** @param {String} value */
|
||||
|
||||
Reference in New Issue
Block a user