Skip to content

Commit 0deaec2

Browse files
added usefull variable that gives last known index of path
1 parent 326567c commit 0deaec2

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

packages/react-diagrams-defaults/src/link/DefaultLinkSegmentWidget.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ export class DefaultLinkSegmentWidget extends React.Component<DefaultLinkSegment
2828
);
2929

3030
const Top = React.cloneElement(Bottom, {
31-
...this.props.extras,
3231
strokeLinecap: 'round',
3332
onMouseLeave: () => {
3433
this.props.onSelection(false);
3534
},
3635
onMouseEnter: () => {
3736
this.props.onSelection(true);
3837
},
38+
...this.props.extras,
3939
ref: null,
4040
'data-linkid': this.props.link.getID(),
4141
strokeOpacity: this.props.selected ? 0.1 : 0,

packages/react-diagrams-routing/src/link/RightAngleLinkModel.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import { DefaultLinkModel, DefaultLinkModelOptions } from '@projectstorm/react-d
22
import { RightAngleLinkFactory } from './RightAngleLinkFactory';
33

44
export class RightAngleLinkModel extends DefaultLinkModel {
5-
constructor(options: DefaultLinkModelOptions = {}) {
5+
lastHoverIndexOfPath: number;
6+
constructor(options: DefaultLinkModelOptions = { }) {
67
super({
78
type: RightAngleLinkFactory.NAME,
89
...options
910
});
11+
this.lastHoverIndexOfPath = 0;
1012
}
1113

1214
performanceTune() {

packages/react-diagrams-routing/src/link/RightAngleLinkWidget.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,10 @@ export class RightAngleLinkWidget extends React.Component<RightAngleLinkProps, R
264264
window.addEventListener('mousemove', this.handleMove);
265265
window.addEventListener('mouseup', this.handleUp);
266266
}
267+
},
268+
onMouseEnter: (event: MouseEvent) => {
269+
this.setState({ selected: true });
270+
this.props.link.lastHoverIndexOfPath = j;
267271
}
268272
},
269273
j

0 commit comments

Comments
 (0)