|  | 
| 1 | 1 | import type { dia } from "jointjs"; | 
| 2 | 2 | import { g } from "jointjs"; | 
| 3 |  | -import { fromEvents, stream } from "kefir"; | 
|  | 3 | +import { fromEvents, interval, stream } from "kefir"; | 
| 4 | 4 | import { useEffect } from "react"; | 
| 5 | 5 | 
 | 
| 6 | 6 | import { getNeighbors } from "../components/graph/getNeighbors"; | 
| 7 | 7 | import { useGraph } from "../components/graph/GraphContext"; | 
| 8 | 8 | import { isModelElement } from "../components/graph/GraphPartialsInTS"; | 
| 9 | 9 | import { Events } from "../components/graph/types"; | 
|  | 10 | +import { isVisualTesting } from "../devHelpers"; | 
| 10 | 11 | 
 | 
| 11 |  | -const frameStream = stream<DOMHighResTimeStamp, unknown>((emitter) => { | 
| 12 |  | -    let frame: number; | 
|  | 12 | +const frameStream = isVisualTesting | 
|  | 13 | +    ? interval(100, 1) | 
|  | 14 | +    : stream<DOMHighResTimeStamp, unknown>((emitter) => { | 
|  | 15 | +          let frame: number; | 
| 13 | 16 | 
 | 
| 14 |  | -    const tick: FrameRequestCallback = (time) => { | 
| 15 |  | -        emitter.emit(time); | 
| 16 |  | -        frame = requestAnimationFrame(tick); | 
| 17 |  | -    }; | 
|  | 17 | +          const tick: FrameRequestCallback = (time) => { | 
|  | 18 | +              emitter.emit(time); | 
|  | 19 | +              frame = requestAnimationFrame(tick); | 
|  | 20 | +          }; | 
| 18 | 21 | 
 | 
| 19 |  | -    frame = requestAnimationFrame(tick); | 
| 20 |  | -    return () => cancelAnimationFrame(frame); | 
| 21 |  | -}); | 
|  | 22 | +          frame = requestAnimationFrame(tick); | 
|  | 23 | +          return () => cancelAnimationFrame(frame); | 
|  | 24 | +      }); | 
| 22 | 25 | 
 | 
| 23 | 26 | function getCellsBox(paper: dia.Paper, cells: dia.Cell[]) { | 
| 24 | 27 |     return cells.reduce((rect, cell) => rect.union(paper.findViewByModel(cell).getBBox()), new g.Rect()); | 
|  | 
0 commit comments