import { createSlice , PayloadAction } from '@reduxjs/toolkit' ; import { RootState } from '../index' ; interface ZoomState { zoomData : any ; } const initialState = { zoomData : { x : 18 , y : 527 , k : 0.12 , } , } ; export const zoomSlice = createSlice ( { name : 'zoom' , initialState , reducers : { updateZoomState : ( state , action ) => { state . zoomData = action . payload ; } , setDefaultZoom : state => { state . zoomData = initialState . zoomData ; } , } , } ) ; export const { updateZoomState , setDefaultZoom } = zoomSlice . actions ; export const selectZoomState = ( state ) => state . zoom . zoomData ; const zoomReducer = zoomSlice . reducer ; export default zoomReducer ;