Skip to content

Commit

Permalink
feat: Rename setNextWindowNoBackground to `setNextWindowDisableBack…
Browse files Browse the repository at this point in the history
…ground`
  • Loading branch information
warxander committed Nov 16, 2023
1 parent 94d98aa commit 2f0cb5c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
5 changes: 2 additions & 3 deletions src/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,8 @@ export function setNextWindowPositionFixed() {
Ui.setNextWindowPositionFixed();
}

/** `false` by default */
export function setNextWindowNoBackground(isNoBackground: boolean) {
Ui.setNextWindowNoBackground(isNoBackground);
export function setNextWindowDisableBackground() {
Ui.setNextWindowDisableBackground();
}

/** Used as a selector name */
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ globalThis.exports('isDebugEnabled', Exports.isDebugEnabled);
globalThis.exports('setDebugEnabled', Exports.setDebugEnabled);

globalThis.exports('setNextWindowPositionFixed', Exports.setNextWindowPositionFixed);
globalThis.exports('setNextWindowNoBackground', Exports.setNextWindowNoBackground);
globalThis.exports('setNextWindowDisableBackground', Exports.setNextWindowDisableBackground);
globalThis.exports('setNextWindowId', Exports.setNextWindowId);
globalThis.exports('setNextWindowSpacing', Exports.setNextWindowSpacing);
globalThis.exports('setNextWindowDisableInput', Exports.setNextWindowDisableInput);
Expand Down
13 changes: 6 additions & 7 deletions src/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ItemState {
enum WindowFlags {
None,
FixedPosition = 1 << 1,
NoBackground = 1 << 2
BackgroundDisabled = 1 << 2
}

class WindowState {
Expand Down Expand Up @@ -66,9 +66,8 @@ export class Ui {
Ui.nextWindowState.windowFlags |= WindowFlags.FixedPosition;
}

static setNextWindowNoBackground(isNoBackground: boolean) {
if (isNoBackground) Ui.nextWindowState.windowFlags |= WindowFlags.NoBackground;
else Ui.nextWindowState.windowFlags &= ~WindowFlags.NoBackground;
static setNextWindowDisableBackground() {
Ui.nextWindowState.windowFlags |= WindowFlags.BackgroundDisabled;
}

static setNextWindowId(id: string) {
Expand Down Expand Up @@ -103,8 +102,8 @@ export class Ui {
return !!(Ui.nextWindowState.windowFlags & WindowFlags.FixedPosition);
}

static isWindowNoBackground(): boolean {
return !!(Ui.nextWindowState.windowFlags & WindowFlags.NoBackground);
static isWindowBackgroundDisabled(): boolean {
return !!(Ui.nextWindowState.windowFlags & WindowFlags.BackgroundDisabled);
}

static isWindowInputDisabled(): boolean {
Expand All @@ -120,7 +119,7 @@ export class Ui {

this.painter.setPosition(x, y);

if (!Ui.isWindowNoBackground())
if (!Ui.isWindowBackgroundDisabled())
this.painter.drawItemBackground(
Ui.style.getProperties(Ui.nextWindowState.id ?? 'window'),
Ui.windowRect.size.x,
Expand Down

0 comments on commit 2f0cb5c

Please sign in to comment.