Skip to content

Commit ccf662e

Browse files
committed
test check
1 parent d7eb7ef commit ccf662e

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

designer/client/src/components/graph/getNeighbors.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function getNeighbors(graph: dia.Graph, element: dia.Element, options: Ge
1313
const result = new Set<dia.Element>(withSelf ? [element] : []);
1414

1515
const walk = (currentElement: dia.Element, remaining: number) => {
16-
if (remaining === 0) return;
16+
if (remaining <= 0) return;
1717
for (const neighbor of graph.getNeighbors(currentElement, { inbound, outbound })) {
1818
if (result.has(neighbor)) continue;
1919
if (neighbor.id === element.id && !withSelf) continue;

designer/client/src/containers/PanToNodes.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
import type { dia } from "jointjs";
22
import { g } from "jointjs";
3-
import { fromEvents, stream } from "kefir";
3+
import { fromEvents, interval, stream } from "kefir";
44
import { useEffect } from "react";
55

66
import { getNeighbors } from "../components/graph/getNeighbors";
77
import { useGraph } from "../components/graph/GraphContext";
88
import { isModelElement } from "../components/graph/GraphPartialsInTS";
99
import { Events } from "../components/graph/types";
10+
import { isVisualTesting } from "../devHelpers";
1011

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;
1316

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+
};
1821

19-
frame = requestAnimationFrame(tick);
20-
return () => cancelAnimationFrame(frame);
21-
});
22+
frame = requestAnimationFrame(tick);
23+
return () => cancelAnimationFrame(frame);
24+
});
2225

2326
function getCellsBox(paper: dia.Paper, cells: dia.Cell[]) {
2427
return cells.reduce((rect, cell) => rect.union(paper.findViewByModel(cell).getBBox()), new g.Rect());

0 commit comments

Comments
 (0)