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