import { AnyAction } from 'redux' ; import { ThunkAction } from 'redux-thunk' ; import { createStandardAction } from 'typesafe-actions' ; import { State } from '../store' ; import { DraggingStateRecord } from '../store/factory/Inspector' ; import { getParentGroupIds } from '../util/hierarchy' ; export namespace InspectorSelectedType { export const SELECT_GUIDE = 'SELECT_GUIDE' ; export const SELECT_MARK = 'SELECT_MARK' ; export const SELECT_PIPELINE = 'SELECT_PIPELINE' ; export const SELECT_SCALE = 'SELECT_SCALE' ; export const SELECT_INTERACTION = 'SELECT_INTERACTION' ; export const SELECT_WIDGET = 'SELECT_WIDGET' ; } export type InspectorSelectedType = 'SELECT_GUIDE' | 'SELECT_MARK' | 'SELECT_PIPELINE' | 'SELECT_SCALE' | 'SELECT_INTERACTION' | 'SELECT_WIDGET' ; param { number [ ] } layerIds returns { Object } export const toggleLayers = createStandardAction ( 'TOGGLE_LAYERS' ) < number [ ] > ( ) ; param { number [ ] } layerIds returns { Object } export const expandLayers = createStandardAction ( 'EXPAND_LAYERS' ) < number [ ] > ( ) ; param { number [ ] } layerIds returns { Object } export const removeLayers = createStandardAction ( 'REMOVE_LAYERS' ) < number [ ] > ( ) ; export const selectGuide = createStandardAction ( InspectorSelectedType . SELECT_GUIDE ) < number > ( ) ; export const baseSelectMark = createStandardAction ( InspectorSelectedType . SELECT_MARK ) < number , number [ ] > ( ) ; export function selectMark ( id ) { return function ( dispatch , getState ) { const parentGroupIds = getParentGroupIds ( id , getState ( ) ) ; dispatch ( baseSelectMark ( id , parentGroupIds ) ) ; } ; } export const selectPipeline = createStandardAction ( InspectorSelectedType . SELECT_PIPELINE ) < number > ( ) ; export const selectScale = createStandardAction ( InspectorSelectedType . SELECT_SCALE ) < number > ( ) ; export const selectInteraction = createStandardAction ( InspectorSelectedType . SELECT_INTERACTION ) < number > ( ) ; export const selectWidget = createStandardAction ( InspectorSelectedType . SELECT_WIDGET ) < number > ( ) ; export const startDragging = createStandardAction ( 'START_DRAGGING' ) < DraggingStateRecord > ( ) ; export const stopDragging = createStandardAction ( 'STOP_DRAGGING' ) ( ) ;