diff --git a/webapp/src/components/DAGFlow/styles.ts b/webapp/src/components/DAGFlow/styles.ts index 1ee735f..96ea1c0 100644 --- a/webapp/src/components/DAGFlow/styles.ts +++ b/webapp/src/components/DAGFlow/styles.ts @@ -1,10 +1,10 @@ import { Styles } from "jss"; import Color from 'chroma-js'; import { createAppUseStyles } from "styles/theme"; -import { Node } from "types/graphs"; +import { NodeColor } from "types/graphs"; export const useNodeStyles = createAppUseStyles<{ - color: Node['color'], + color: NodeColor, nodeHeight: number, nodeWidth: number, }>(theme => { diff --git a/webapp/src/types/graphs.ts b/webapp/src/types/graphs.ts index 1f0aaf1..d0f184f 100644 --- a/webapp/src/types/graphs.ts +++ b/webapp/src/types/graphs.ts @@ -1,13 +1 @@ -export type Point = [number, number]; -export type BBox = [Point, Point]; export type NodeColor = 'red' | 'blue' | 'green'; -export interface Node { - loc: Point; - text: string; - color: NodeColor; -} -export type EdgeDirection = '1->2' | '1<->2' | '1<-2'; -export interface BoundedObj { - elm: J; - bbox: BBox; -} diff --git a/webapp/src/utils/graph.ts b/webapp/src/utils/graph.ts deleted file mode 100644 index bd3c8c1..0000000 --- a/webapp/src/utils/graph.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { Point } from "types/graphs"; - -export const offsetPoint = ( - [x, y]: Point, - [ox, oy]: Point = [0, 0], -): Point => [x + ox, y + oy]; - -export const applyPoints = ( - [x1, y1]: Point, - [x2, y2]: Point, - fun: (a: number, b: number) => number, -): Point => [fun(x1, x2), fun(y1, y2)]; - -export const avgPoints = ( - p1: Point, - p2: Point, -): Point => applyPoints(p1, p2, (a,b) => (a+b)/2); - - -export const minPoints = ( - p1: Point, - p2: Point, -): Point => applyPoints(p1, p2, Math.min); - -export const maxPoints = ( - p1: Point, - p2: Point, -): Point => applyPoints(p1, p2, Math.max); - -export const makeOffsetMaintainer = (startPoint: Point) => { - let offset: Point = [0, 0]; - let i = 0; - return { - setI(newI: number) { - i = newI; - }, - resetY() { - offset[1] = 0; - }, - update(p: Point, innerStartLoc: Point) { - offset[0] = Math.max(offset[0], p[0] - i - 0.5 - startPoint[0]) - offset[1] = Math.max(offset[1], p[1] - innerStartLoc[1] + 1) - }, - get x() { - return offset[0] - }, - get y() { - return offset[1] - } - } -}