mirror of
https://github.com/stan-smith/FossFLOW.git
synced 2025-12-27 00:19:14 -05:00
feat: changes starting mode to PAN
This commit is contained in:
@@ -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
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user