Skip to content

Commit 4ddf9ea

Browse files
committed
fix little bug with re-connector
1 parent d41ee3f commit 4ddf9ea

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

web/src/drawing/index.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,8 @@ import drawConnection, {
1212
import drawOverlay from './drawOverlay'
1313
import drawSelectBox from './drawSelectBox'
1414
import drawEntryPoints from './drawEntryPoints'
15-
import {
16-
RELATION_AS_CHILD,
17-
} from '../redux/ephemeral/outcome-connector/actions'
18-
import {
19-
getOutcomeHeight,
20-
getOutcomeWidth,
21-
} from './dimensions'
15+
import { RELATION_AS_CHILD } from '../redux/ephemeral/outcome-connector/actions'
16+
import { getOutcomeHeight, getOutcomeWidth } from './dimensions'
2217
import {
2318
ComputedOutcome,
2419
ComputedSimpleAchievementStatus,
@@ -31,7 +26,10 @@ import { ProjectConnectionsState } from '../redux/persistent/projects/connection
3126
import { ProjectEntryPointsState } from '../redux/persistent/projects/entry-points/reducer'
3227
import { ProjectOutcomeMembersState } from '../redux/persistent/projects/outcome-members/reducer'
3328
import { getPlaceholderOutcome } from './drawOutcome/placeholderOutcome'
34-
import { CoordinatesState, DimensionsState } from '../redux/ephemeral/layout/state-type'
29+
import {
30+
CoordinatesState,
31+
DimensionsState,
32+
} from '../redux/ephemeral/layout/state-type'
3533

3634
function setupCanvas(canvas) {
3735
// Get the device pixel ratio, falling back to 1.
@@ -62,14 +60,15 @@ export type renderProps = {
6260
connections: ProjectConnectionsState
6361
outcomeConnectorFromAddress: ActionHashB64
6462
outcomeConnectorToAddress: ActionHashB64
65-
existingParentConnectionAddress: ActionHashB64
6663
outcomeConnectorRelation: RelationInput
64+
outcomeConnectorExistingParent: ActionHashB64
6765
outcomeFormIsOpen: boolean
6866
outcomeFormFromActionHash: ActionHashB64
6967
outcomeFormContent: string
7068
outcomeFormRelation: RelationInput
7169
outcomeFormLeftConnectionX: number
7270
outcomeFormTopConnectionY: number
71+
outcomeFormExistingParent: ActionHashB64
7372
hoveredConnectionActionHash: ActionHashB64
7473
selectedConnections: ActionHashB64[]
7574
selectedOutcomes: ActionHashB64[]
@@ -115,13 +114,14 @@ function render(
115114
outcomeConnectorFromAddress,
116115
outcomeConnectorToAddress,
117116
outcomeConnectorRelation,
118-
existingParentConnectionAddress,
117+
outcomeConnectorExistingParent,
119118
outcomeFormIsOpen,
120119
outcomeFormFromActionHash,
121120
outcomeFormRelation,
122121
outcomeFormContent,
123122
outcomeFormLeftConnectionX,
124123
outcomeFormTopConnectionY,
124+
outcomeFormExistingParent,
125125
hoveredConnectionActionHash,
126126
selectedConnections,
127127
selectedOutcomes,
@@ -178,7 +178,14 @@ function render(
178178
// if in the pending re-parenting mode for the child card of an existing connection,
179179
// temporarily omit/hide the existing connection from view
180180
// ASSUMPTION: one parent
181-
if (connection.actionHash === existingParentConnectionAddress) return
181+
if (
182+
connection.actionHash === outcomeFormExistingParent ||
183+
connection.actionHash === outcomeConnectorExistingParent
184+
) {
185+
// do not draw, because we are pre-representing the
186+
// fact that this connection will be deleted/replaced
187+
return
188+
}
182189

183190
const childCoords = coordinates[connection.childActionHash]
184191
const parentCoords = coordinates[connection.parentActionHash]

web/src/routes/ProjectView/MapView/selectRenderProps.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const selectRenderProps = createSelector(
2525
(state: RootState) => state.ui.outcomeForm.content,
2626
(state: RootState) => state.ui.outcomeForm.leftConnectionXPosition,
2727
(state: RootState) => state.ui.outcomeForm.topConnectionYPosition,
28+
(state: RootState) => state.ui.outcomeForm.existingParentConnectionAddress,
2829
(state: RootState) => state.ui.hover.hoveredConnection,
2930
(state: RootState) => state.ui.selection.selectedConnections,
3031
(state: RootState) => state.ui.selection.selectedOutcomes,
@@ -49,12 +50,13 @@ const selectRenderProps = createSelector(
4950
outcomeConnectorFromAddress,
5051
outcomeConnectorToAddress,
5152
outcomeConnectorRelation,
52-
existingParentConnectionAddress,
53+
outcomeConnectorExistingParent,
5354
outcomeFormFromActionHash,
5455
outcomeFormRelation,
5556
outcomeFormContent,
5657
outcomeFormLeftConnectionX,
5758
outcomeFormTopConnectionY,
59+
outcomeFormExistingParent,
5860
hoveredConnectionActionHash,
5961
selectedConnections,
6062
selectedOutcomes,
@@ -79,13 +81,14 @@ const selectRenderProps = createSelector(
7981
outcomeConnectorFromAddress,
8082
outcomeConnectorToAddress,
8183
outcomeConnectorRelation,
82-
existingParentConnectionAddress,
84+
outcomeConnectorExistingParent,
8385
outcomeFormIsOpen,
8486
outcomeFormFromActionHash,
8587
outcomeFormRelation,
8688
outcomeFormContent,
8789
outcomeFormLeftConnectionX,
8890
outcomeFormTopConnectionY,
91+
outcomeFormExistingParent,
8992
hoveredConnectionActionHash,
9093
selectedConnections,
9194
selectedOutcomes,

0 commit comments

Comments
 (0)