aboutsummaryrefslogtreecommitdiff
path: root/src/store.ts
blob: 8b92c6faab44312647b5bfebb8a9960b9b1bda5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * Defines a global store for UI settings, palette colors, etc
 */

import {defineStore} from 'pinia';
import {CalDate} from './lib';

export const useStore = defineStore('store', {
	state: () => {
		const color = { // Note: For scrollbar colors on chrome, edit ./index.css
			text: '#fafaf9',     // stone-50
			textDark: '#a8a29e', // stone-400
			bg: '#292524',       // stone-800
			bgLight: '#44403c',  // stone-700
			bgDark: '#1c1917',   // stone-900
			bgLight2: '#57534e', // stone-600
			bgDark2: '#0e0c0b',  // darker version of stone-900
			alt: '#fde047',      // yellow-300
			altDark: '#eab308',  // yellow-500
			altDark2: '#ca8a04', // yellow-600
			altBg: '#6a5e2e'
		};
		return {
			tickLen: 16,
			largeTickLen: 32,
			endTickSz: 8, // Size for start/end ticks
			tickLabelHeight: 10,
			minTickSep: 30, // Smallest px separation between ticks
			minLastTicks: 3, // When at smallest scale, don't zoom further into less than this many ticks
			defaultEndTickOffset: 0.5, // Default fraction of a unit to offset start/end ticks
			//
			mainlineBreadth: 80, // Breadth of mainline area (including ticks and labels)
			eventImgSz: 100, // Width/height of event images
			eventLabelHeight: 20,
			spacing: 10, // Spacing between display edge, events, and mainline area
			//
			scrollRatio: 0.2, // Fraction of timeline length to move by upon scroll
			zoomRatio: 1.5, // Ratio of timeline expansion upon zooming out
			dragInertia: 0.1, // Multiplied by final-drag-speed (pixels-per-sec) to get extra scroll distance
			//
			initialStartDate: new CalDate(1900, 1, 1),
			initialEndDate: new CalDate(2000, 1, 1),
			color,
			showEventCounts: true,
			transitionDuration: 300,
		};
	},
});