Skip to content

Commit

Permalink
style: format tidy.ts
Browse files Browse the repository at this point in the history
Pure styling, no functional changes here.

Signed-off-by: Drew Hess <[email protected]>
  • Loading branch information
dhess committed May 4, 2024
1 parent 6fdd8e1 commit 6be5800
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/components/TreeReactFlow/tidy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,19 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

import { Tidy, Tidy as TidyWasm, WasmLayoutType as LayoutType } from '@hackworthltd/tidyt-wasm';
import { Disposable } from './dispose';
import {
Tidy,
Tidy as TidyWasm,
WasmLayoutType as LayoutType,
} from "@hackworthltd/tidyt-wasm";
import { Disposable } from "./dispose";

export { LayoutType };

function visit<T extends { children: T[] }>(
node: T,
func: (node: T, depth: number) => void,
depth = 0,
depth = 0
) {
func(node, depth);
for (const child of node.children) {
Expand Down Expand Up @@ -77,15 +81,15 @@ export class TidyLayout extends Disposable {
static async create(
type: LayoutType = LayoutType.Tidy,
parent_child_margin = 40,
peer_margin = 10,
peer_margin = 10
) {
return new TidyLayout(type, parent_child_margin, peer_margin);
}

private constructor(
type: LayoutType = LayoutType.Tidy,
parent_child_margin: number,
peer_margin: number,
peer_margin: number
) {
super();
if (type === LayoutType.Basic) {
Expand All @@ -95,7 +99,7 @@ export class TidyLayout extends Disposable {
} else if (type === LayoutType.LayeredTidy) {
this.tidy = TidyWasm.with_layered_tidy(parent_child_margin, peer_margin);
} else {
throw new Error('not implemented');
throw new Error("not implemented");
}
this._register({
dispose: () => {
Expand Down Expand Up @@ -144,7 +148,7 @@ export class TidyLayout extends Disposable {
node.id,
node.width,
node.height,
node.parentId ?? NULL_ID(),
node.parentId ?? NULL_ID()
);
});

Expand Down Expand Up @@ -186,7 +190,7 @@ export class TidyLayout extends Disposable {
new Uint32Array(ids),
new Float64Array(width),
new Float64Array(height),
new Uint32Array(parents),
new Uint32Array(parents)
);

return this.root;
Expand Down

0 comments on commit 6be5800

Please sign in to comment.