Skip to content

Commit 4455762

Browse files
authored
Merge pull request #2 from Aksem/feature/improve-anchors
v1.2.1: rework anchors logic, move router options and edge in …
2 parents b131af0 + 4dce73b commit 4455762

28 files changed

+1202
-766
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@ jobs:
66
runs-on: ${{ matrix.os }}
77
strategy:
88
matrix:
9-
node-version: [12.x]
9+
node-version: [16.x]
1010
os: [ubuntu-latest]
1111
steps:
12-
- uses: actions/checkout@v1
12+
- uses: actions/checkout@v4
1313
- name: Use Node.js ${{ matrix.node_version }}
14-
uses: actions/setup-node@v1
14+
uses: actions/setup-node@v3
1515
with:
1616
node-version: ${{ matrix.node_version }}
1717
- name: npm install, build, and test
1818
run: |
1919
npm install
20-
npm run test
20+
npm run build
21+
# npm run test
2122
env:
2223
CI: true

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99
publish:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v1
13-
- uses: actions/setup-node@v1
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v3
1414
with:
15-
node-version: 12
15+
node-version: 16
1616
- run: npm install
1717
- run: npm run coverage
1818

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@
7878
});
7979
```
8080
81+
## Known limitations
82+
83+
- if AnchorComputer returns anchors on sides of connectables on first rendering, then anchors are attached to sides of connectables
84+
and it cannot be changed later even if AnchorComputer returns new values not on sides. This is because libavoid doesn't have
85+
public API for changing type of anchor(absolute/relative) yet.
86+
8187
## Development
8288
8389
Notes:

base.tsconfig.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
"lib": [
66
"es6", "dom"
77
],
8-
"types": [
9-
"reflect-metadata"
10-
],
118
"typeRoots": [
129
"node_modules/@types", "typings"
1310
],
@@ -24,4 +21,4 @@
2421
"esModuleInterop": true,
2522
"jsx": "react"
2623
}
27-
}
24+
}

dist/connection-pins-utils.d.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Avoid as AvoidInterface } from "libavoid-js";
2+
import { SConnectableElementImpl, SParentElementImpl, IAnchorComputer } from "sprotty";
3+
import { Point, Bounds } from "sprotty-protocol";
4+
export type ShapeConnPinsInfo = {
5+
left: AvoidInterface["ShapeConnectionPin"];
6+
leftIsOnSide: boolean;
7+
right: AvoidInterface["ShapeConnectionPin"];
8+
rightIsOnSide: boolean;
9+
top: AvoidInterface["ShapeConnectionPin"];
10+
topIsOnSide: boolean;
11+
bottom: AvoidInterface["ShapeConnectionPin"];
12+
bottomIsOnSide: boolean;
13+
center: AvoidInterface["ShapeConnectionPin"];
14+
};
15+
export type ShapeInfo = {
16+
ref: AvoidInterface["ShapeRef"];
17+
bounds: Bounds;
18+
connPins: ShapeConnPinsInfo;
19+
};
20+
export declare function getRelativeAnchor(connectable: SConnectableElementImpl, refPoint: Point, refContainer: SParentElementImpl, anchorComputer: IAnchorComputer, anchorCorrection?: number): Point;
21+
export declare function addConnectionPinsToShape(shapeRef: AvoidInterface["ShapeRef"], child: SConnectableElementImpl, centerPoint: Point, anchorComputer: IAnchorComputer, Avoid: AvoidInterface): ShapeConnPinsInfo;
22+
export declare function getCenterPoint(element: SConnectableElementImpl): {
23+
x: number;
24+
y: number;
25+
};
26+
export declare function updateConnPinsOnShapeResize(child: SConnectableElementImpl, shapeInfo: ShapeInfo, anchorComputer: IAnchorComputer, Avoid: AvoidInterface): void;
27+
//# sourceMappingURL=connection-pins-utils.d.ts.map

dist/connection-pins-utils.d.ts.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/connection-pins-utils.js

Lines changed: 94 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/connection-pins-utils.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)