2022-12-21 15:07:29 +00:00
|
|
|
/**
|
|
|
|
* Stores global variables without polluting the global namespace.
|
|
|
|
*/
|
|
|
|
|
|
|
|
const global = {
|
2023-01-03 00:43:33 +00:00
|
|
|
// If this is the first run of openOutpaint
|
|
|
|
get firstRun() {
|
|
|
|
return this._firstRun;
|
|
|
|
},
|
|
|
|
|
2022-12-21 15:07:29 +00:00
|
|
|
// 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;
|
|
|
|
},
|
2022-12-21 21:29:11 +00:00
|
|
|
|
|
|
|
// If there is a selected input
|
|
|
|
hasActiveInput: false,
|
2022-12-24 14:56:30 +00:00
|
|
|
|
2022-12-29 05:39:32 +00:00
|
|
|
// If cursor size sync is enabled
|
|
|
|
syncCursorSize: false,
|
|
|
|
|
2022-12-24 14:56:30 +00:00
|
|
|
// 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;
|
|
|
|
},
|
2023-01-05 00:00:17 +00:00
|
|
|
|
|
|
|
// HRFix compatibility shenanigans
|
|
|
|
isOldHRFix: false,
|
2022-12-21 15:07:29 +00:00
|
|
|
};
|
2023-01-03 00:43:33 +00:00
|
|
|
|
|
|
|
global._firstRun = !localStorage.getItem("openoutpaint/host");
|