openOutpaint/js/global.js
Victor Seiji Hariki 14aed51a89 debugging button to help get information
Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
2022-12-24 11:56:30 -03:00

45 lines
721 B
JavaScript

/**
* Stores global variables without polluting the global namespace.
*/
const global = {
// 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 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;
},
};