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

View File

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