Skip to content

Commit f1faa66

Browse files
authored
Merge pull request #179 from Linkurious/develop
v5.1.13
2 parents 12da8eb + e7f2fc5 commit f1faa66

File tree

69 files changed

+1239
-465
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1239
-465
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 5.1.11
2+
current_version = 5.1.12
33
commit = False
44
tag = False
55
serialize =

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@ node_modules
22
dist
33
reports
44
web/index-bundle.*
5+
6+
# Playwright
7+
/test-results/
8+
playwright-report
9+
blob-report/
10+
playwright/.cache/

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20.18.3
1+
22.17.1

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.1.11
1+
5.1.12

README.md

Lines changed: 46 additions & 38 deletions
Large diffs are not rendered by default.

demo/src/App.tsx

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
EdgeStyle,
1818
StyleClass,
1919
NodeGrouping,
20-
Popup,
2120
Geo,
2221
NodeGroupingProps,
2322
useEvent,
@@ -45,10 +44,6 @@ export default function App() {
4544
const [graph, setGraph] = useState<RawGraph>();
4645
const [loading, setLoading] = useState(true);
4746

48-
// UI states
49-
const [popupOpen, setPopupOpen] = useState(false);
50-
const [clickedNode, setClickedNode] = useState<OgmaNode>();
51-
5247
// ogma instance and grouping references
5348
const ogmaInstanceRef = createRef<OgmaLib>();
5449
const groupingRef = createRef<NodeGroupingTransformation<ND, ED>>();
@@ -75,12 +70,6 @@ export default function App() {
7570
// UI layers
7671
const [outlines, setOutlines] = useState(false);
7772

78-
const popupPosition = useCallback(
79-
() => (clickedNode ? clickedNode.getPosition() : null),
80-
[clickedNode]
81-
);
82-
const onPopupClose = useCallback(() => setPopupOpen(false), []);
83-
8473
// load the graph
8574
useEffect(() => {
8675
setLoading(true);
@@ -92,20 +81,14 @@ export default function App() {
9281
});
9382
}, []);
9483

95-
const onClick = useEvent("click", ({ target }) => {
96-
if (target && target.isNode) {
97-
setClickedNode(target);
98-
setPopupOpen(true);
99-
}
100-
});
101-
10284
const onAddNodes = useEvent("addNodes", () => {
10385
if (!ogmaInstanceRef.current) return;
10486
ogmaInstanceRef.current.view.locateGraph({ duration: 250, padding: 50 });
10587
});
10688

10789
const onReady = useCallback((instance: OgmaLib<ND, ED>) => {
10890
ogmaInstanceRef.current = instance;
91+
window.ogma = instance;
10992
}, []);
11093

11194
const addNode = useCallback(() => {
@@ -140,7 +123,6 @@ export default function App() {
140123
<Ogma
141124
ref={ogmaInstanceRef}
142125
graph={graph}
143-
onClick={onClick}
144126
onAddNodes={onAddNodes}
145127
onReady={onReady}
146128
theme={morningBreeze as Theme<ND, ED>}
@@ -194,16 +176,6 @@ export default function App() {
194176
nodeGenerator={groupingOptions.nodeGenerator}
195177
/>
196178

197-
{/* context-aware UI */}
198-
<Popup
199-
position={popupPosition}
200-
onClose={onPopupClose}
201-
isOpen={!!clickedNode && popupOpen}
202-
>
203-
{!!clickedNode && (
204-
<div className="content">{`Node ${clickedNode.getId()}:`}</div>
205-
)}
206-
</Popup>
207179
<Tooltip
208180
eventName="nodeRightclick"
209181
placement="right"

demo/src/components/Controls.css

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.control-buttons > button {
2+
position: absolute;
3+
z-index: 1000;
4+
top: 15px;
5+
right: 15px;
6+
padding: 3px 7px 0px 7px;
7+
}
8+
9+
.drawer-content {
10+
display: flex;
11+
flex-direction: column;
12+
padding: 20px;
13+
height: calc(100% - 40px);
14+
justify-content: space-between;
15+
}
16+
17+
.link-button {
18+
width: fit-content;
19+
text-align: left;
20+
color: #38f;
21+
text-decoration: underline;
22+
cursor: pointer;
23+
}
24+
25+
h2 {
26+
margin-bottom: 0;
27+
}
28+
29+
h3 {
30+
margin-top: 0;
31+
}

demo/src/components/Controls.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Drawer } from "./Drawer";
33
import { Toggle } from "./Toggle";
44
import { Slider } from "./Slider";
55
import { Menu as MenuIcon } from "react-feather";
6+
import "./Controls.css";
67

78
interface ControlsProps {
89
toggleNodeGrouping: (value: boolean) => void;

demo/src/components/Drawer.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
transform: translateX(0);
1515
}
1616

17-
.drawer-content {
18-
padding: 20px;
19-
}
20-
2117
.close-button {
2218
position: absolute;
2319
top: 10px;

demo/src/index.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,16 @@ code {
4848
left: 15px;
4949
z-index: 401;
5050
display: flex;
51+
gap: 5px;
52+
align-items: center;
5153
backdrop-filter: blur(5px);
5254
}
5355

56+
.gh-link > div {
57+
display: flex;
58+
align-items: center;
59+
}
60+
5461
.ogma-tooltip {
5562
background-color: black;
5663
color: white;

0 commit comments

Comments
 (0)