mirror of
https://github.com/markmanx/isoflow.git
synced 2025-02-08 04:18:29 +00:00
feat: changes starting mode to PAN
This commit is contained in:
parent
4de4882b03
commit
5f015c4539
2 changed files with 9 additions and 12 deletions
|
@ -1,4 +1,4 @@
|
|||
import { Size, Coords, SceneInput, Connector } from 'src/types';
|
||||
import { Size, Coords, SceneInput, Connector, Mode } from 'src/types';
|
||||
import { customVars } from './styles/theme';
|
||||
|
||||
// TODO: This file could do with better organisation and convention for easier reading.
|
||||
|
@ -49,3 +49,7 @@ export const INITIAL_SCENE: SceneInput = {
|
|||
textBoxes: [],
|
||||
rectangles: []
|
||||
};
|
||||
export const STARTING_MODE: Mode = {
|
||||
type: 'PAN',
|
||||
showCursor: false
|
||||
};
|
||||
|
|
|
@ -2,6 +2,7 @@ import React, { createContext, useContext, useRef } from 'react';
|
|||
import { createStore, useStore } from 'zustand';
|
||||
import { CoordsUtils, incrementZoom, decrementZoom } from 'src/utils';
|
||||
import { UiStateStore } from 'src/types';
|
||||
import { STARTING_MODE } from 'src/config';
|
||||
|
||||
const initialState = () => {
|
||||
return createStore<UiStateStore>((set, get) => {
|
||||
|
@ -9,11 +10,7 @@ const initialState = () => {
|
|||
iconCategoriesState: [],
|
||||
disableInteractions: false,
|
||||
hideMainMenu: false,
|
||||
mode: {
|
||||
type: 'CURSOR',
|
||||
showCursor: true,
|
||||
mousedownItem: null
|
||||
},
|
||||
mode: STARTING_MODE,
|
||||
isMainMenuOpen: false,
|
||||
mouse: {
|
||||
position: { screen: CoordsUtils.zero(), tile: CoordsUtils.zero() },
|
||||
|
@ -35,11 +32,7 @@ const initialState = () => {
|
|||
},
|
||||
resetUiState: () => {
|
||||
set({
|
||||
mode: {
|
||||
type: 'CURSOR',
|
||||
showCursor: true,
|
||||
mousedownItem: null
|
||||
},
|
||||
mode: STARTING_MODE,
|
||||
scroll: {
|
||||
position: CoordsUtils.zero(),
|
||||
offset: CoordsUtils.zero()
|
||||
|
@ -91,7 +84,7 @@ const initialState = () => {
|
|||
set({ mode: { type: 'INTERACTIONS_DISABLED', showCursor: false } });
|
||||
} else {
|
||||
set({
|
||||
mode: { type: 'CURSOR', showCursor: true, mousedownItem: null }
|
||||
mode: STARTING_MODE
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue