factor out default appState color constants

This commit is contained in:
dwelle 2023-01-17 22:27:38 +01:00
parent b9ba407f96
commit 33ab88926f
2 changed files with 11 additions and 6 deletions

View File

@ -1,13 +1,15 @@
import oc from "open-color";
import {
DEFAULT_BACKGROUND_COLOR,
DEFAULT_FONT_FAMILY,
DEFAULT_FONT_SIZE,
DEFAULT_STROKE_COLOR,
DEFAULT_TEXT_ALIGN,
DEFAULT_ZOOM_VALUE,
EXPORT_SCALES,
THEME,
} from "./constants";
import { t } from "./i18n";
import { AppState, NormalizedZoomValue } from "./types";
import { AppState } from "./types";
import { getDateTime } from "./utils";
const defaultExportScale = EXPORT_SCALES.includes(devicePixelRatio)
@ -31,7 +33,7 @@ export const getDefaultAppState = (): Omit<
currentItemOpacity: 100,
currentItemRoughness: 1,
currentItemStartArrowhead: null,
currentItemStrokeColor: oc.black,
currentItemStrokeColor: DEFAULT_STROKE_COLOR,
currentItemRoundness: "round",
currentItemStrokeStyle: "solid",
currentItemStrokeWidth: 1,
@ -83,10 +85,10 @@ export const getDefaultAppState = (): Omit<
startBoundElement: null,
suggestedBindings: [],
toast: null,
viewBackgroundColor: oc.white,
viewBackgroundColor: DEFAULT_BACKGROUND_COLOR,
zenModeEnabled: false,
zoom: {
value: 1 as NormalizedZoomValue,
value: DEFAULT_ZOOM_VALUE,
},
viewModeEnabled: false,
pendingImageElementId: null,

View File

@ -1,5 +1,5 @@
import cssVariables from "./css/variables.module.scss";
import { AppProps } from "./types";
import { AppProps, NormalizedZoomValue } from "./types";
import { FontFamilyValues } from "./element/types";
export const isDarwin = /Mac|iPod|iPhone|iPad/.test(navigator.platform);
@ -93,6 +93,9 @@ export const DEFAULT_FONT_FAMILY: FontFamilyValues = FONT_FAMILY.Virgil;
export const DEFAULT_TEXT_ALIGN = "left";
export const DEFAULT_VERTICAL_ALIGN = "top";
export const DEFAULT_VERSION = "{version}";
export const DEFAULT_BACKGROUND_COLOR = "#ffffff";
export const DEFAULT_STROKE_COLOR = "#000000";
export const DEFAULT_ZOOM_VALUE = 1 as NormalizedZoomValue;
export const CANVAS_ONLY_ACTIONS = ["selectAll"];