Compare commits

...

2 Commits

Author SHA1 Message Date
Ruben Fiszel
4fceae4f85 progress 2023-02-01 20:54:13 +01:00
Ruben Fiszel
c1cfed840a all 2023-02-01 16:27:50 +01:00
2 changed files with 11 additions and 4 deletions

View File

@@ -180,6 +180,9 @@ export function emptyFlowModuleState(): FlowModuleState {
const aCharCode = 'a'.charCodeAt(0)
export function numberToChars(n: number, skipTilde: boolean = false) {
if (n < 0) {
return "-" + numberToChars(-n, skipTilde)
}
var b = [n],
sp,
out,
@@ -207,6 +210,9 @@ export function numberToChars(n: number, skipTilde: boolean = false) {
}
export function charsToNumber(n: string): number {
if (n.charAt(0) == '-') {
return charsToNumber(n.slice(1)) * -1
}
let b = Math.pow(27, n.length - 1)
let res = 0
for (let c of n) {

View File

@@ -123,7 +123,7 @@
return flowModuleToBranch(
module,
branches,
['Default', ...module.value.branches.map((x) => `If ${truncateRev(x.expr, 20)}`)],
['Default', ...module.value.branches.map((x) => `${truncateRev(x.expr, 20)}`)],
parent,
insideLoop
)
@@ -328,11 +328,11 @@
if (!modules.length) {
items.push(createVirtualNode(branchParent, 'Empty branch', edgesLabel[i]))
} else {
modules.forEach((module) => {
modules.forEach((module, j) => {
const item = getConvertedFlowModule(
module,
items.length ? items : numberToChars(branch.node.id),
edgesLabel[i],
j == 0 ? edgesLabel[i] : undefined,
insideLoop
)
item && items.push(item)
@@ -434,8 +434,9 @@
edgesLabel?: string,
offset?: number
): Node {
const id = -idGenerator.next().value - 1 + (offset ?? 0)
return {
id: -idGenerator.next().value - 1 + (offset ?? 0),
id,
position: { x: -1, y: -1 },
data: {
html: `