File size: 1,061 Bytes
b5ba7a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
 * Stores global variables without polluting the global namespace.
 */

const global = {
	// If this is the first run of openOutpaint
	get firstRun() {
		return this._firstRun;
	},

	// Connection
	_connection: "offline",
	set connection(v) {
		this._connection = v;

		toolbar &&
			toolbar.currentTool &&
			toolbar.currentTool.state.redraw &&
			toolbar.currentTool.state.redraw();
	},
	get connection() {
		return this._connection;
	},

	// If there is a selected input
	hasActiveInput: false,

	// If cursor size sync is enabled
	syncCursorSize: false,

	// If debugging is enabled
	_debug: false,
	set debug(v) {
		if (debugLayer) {
			if (v) {
				debugLayer.unhide();
			} else {
				debugLayer.hide();
			}
		}

		this._debug = v;
	},
	get debug() {
		return this._debug;
	},
	/**
	 * Toggles debugging.
	 */
	toggledebug() {
		this.debug = !this.debug;
	},

	// HRFix compatibility shenanigans
	isOldHRFix: false,

	// WebUI object to communitate with parent window
	webui: null,
};

global._firstRun = !localStorage.getItem("openoutpaint/host");