fix(connection): always scale handle dimensions
This commit is contained in:
+11
-2
@@ -2,7 +2,8 @@ import {
|
||||
UPDATE_TRANSFORM, UPDATE_SIZE, SET_NODES, SET_EDGES,
|
||||
UPDATE_NODE_DATA, UPDATE_NODE_POS, INIT_D3, FIT_VIEW,
|
||||
UPDATE_SELECTION, SET_SELECTION, SET_NODES_SELECTION,
|
||||
SET_SELECTED_ELEMENTS, REMOVE_NODES, ZOOM_IN, ZOOM_OUT
|
||||
SET_SELECTED_ELEMENTS, REMOVE_NODES, ZOOM_IN, ZOOM_OUT,
|
||||
SET_CONNECTING, SET_CONNECTION_POS
|
||||
} from './index';
|
||||
|
||||
export const updateTransform = (transform) => {
|
||||
@@ -90,7 +91,7 @@ export const removeNodes = (ids) => {
|
||||
const idArray = Array.isArray(ids) ? ids : [ids];
|
||||
|
||||
return { type: REMOVE_NODES, payload: { ids: idArray } };
|
||||
}
|
||||
};
|
||||
|
||||
export const updateSelection = (selection) => {
|
||||
return {
|
||||
@@ -100,3 +101,11 @@ export const updateSelection = (selection) => {
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const setConnecting = ({ isConnecting, connectionSourceId }) => {
|
||||
return { type: SET_CONNECTING, payload: { isConnecting, connectionSourceId }};
|
||||
};
|
||||
|
||||
export const setConnectionPos = ({ x, y }) => {
|
||||
return { type: SET_CONNECTION_POS, payload: { connectionPosition: { x, y } } };
|
||||
}
|
||||
@@ -17,6 +17,8 @@ export const SET_SELECTION = 'SET_SELECTION';
|
||||
export const SET_NODES_SELECTION = 'SET_NODES_SELECTION';
|
||||
export const SET_SELECTED_ELEMENTS = 'SET_SELECTED_ELEMENTS';
|
||||
export const REMOVE_NODES = 'REMOVE_NODES';
|
||||
export const SET_CONNECTING = 'SET_CONNECTING';
|
||||
export const SET_CONNECTION_POS = 'SET_CONNECTION_POS';
|
||||
|
||||
export const initialState = {
|
||||
width: 0,
|
||||
@@ -34,6 +36,10 @@ export const initialState = {
|
||||
nodesSelectionActive: false,
|
||||
selectionActive: false,
|
||||
selection: {},
|
||||
|
||||
isConnecting: false,
|
||||
connectionSourceId: null,
|
||||
connectionPosition: { x: 0, y: 0 }
|
||||
};
|
||||
|
||||
export const reducer = (state, action) => {
|
||||
@@ -126,6 +132,8 @@ export const reducer = (state, action) => {
|
||||
case UPDATE_SIZE:
|
||||
case SET_SELECTION:
|
||||
case SET_SELECTED_ELEMENTS:
|
||||
case SET_CONNECTING:
|
||||
case SET_CONNECTION_POS:
|
||||
return { ...state, ...action.payload };
|
||||
default:
|
||||
return state;
|
||||
|
||||
Reference in New Issue
Block a user