25 lines
495 B
TypeScript
25 lines
495 B
TypeScript
import { createSlice } from '@reduxjs/toolkit';
|
|
|
|
|
|
const initialMouseState = {
|
|
down: false,
|
|
starting: { x: -1, y: -1 },
|
|
timestamp:0,
|
|
};
|
|
|
|
const mouseHandlerSlice = createSlice({
|
|
name: 'mouseHandler',
|
|
initialState: initialMouseState,
|
|
reducers: {
|
|
init(state) {
|
|
return initialMouseState;
|
|
},
|
|
set(state, action) {
|
|
return action.payload;
|
|
},
|
|
},
|
|
});
|
|
|
|
export const mouseHandlerActions = mouseHandlerSlice.actions;
|
|
|
|
export default mouseHandlerSlice.reducer; |