diff --git a/src/exports.ts b/src/exports.ts index 2e3c61c..1ab376e 100644 --- a/src/exports.ts +++ b/src/exports.ts @@ -217,9 +217,8 @@ export function setDebugEnabled(enabled: boolean) { Ui.setDebugEnabled(enabled); } -/** `false` by default */ -export function setNextWindowNoDrag(isNoDrag: boolean) { - Ui.setNextWindowNoDrag(isNoDrag); +export function setNextWindowPositionFixed() { + Ui.setNextWindowPositionFixed(); } /** `false` by default */ diff --git a/src/index.ts b/src/index.ts index 84dc235..a5b0c4a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,7 +5,7 @@ globalThis.exports('getUi', Exports.getUi); globalThis.exports('isDebugEnabled', Exports.isDebugEnabled); globalThis.exports('setDebugEnabled', Exports.setDebugEnabled); -globalThis.exports('setNextWindowNoDrag', Exports.setNextWindowNoDrag); +globalThis.exports('setNextWindowPositionFixed', Exports.setNextWindowPositionFixed); globalThis.exports('setNextWindowNoBackground', Exports.setNextWindowNoBackground); globalThis.exports('setNextWindowId', Exports.setNextWindowId); globalThis.exports('setNextWindowSpacing', Exports.setNextWindowSpacing); diff --git a/src/ui.ts b/src/ui.ts index 42987ef..769dcba 100644 --- a/src/ui.ts +++ b/src/ui.ts @@ -11,7 +11,7 @@ class ItemState { enum WindowFlags { None, - NoDrag = 1 << 1, + FixedPosition = 1 << 1, NoBackground = 1 << 2 } @@ -62,9 +62,8 @@ export class Ui { Ui.isDebugEnabled_ = enabled; } - static setNextWindowNoDrag(isNoDrag: boolean) { - if (isNoDrag) Ui.nextWindowState.windowFlags |= WindowFlags.NoDrag; - else Ui.nextWindowState.windowFlags &= ~WindowFlags.NoDrag; + static setNextWindowPositionFixed() { + Ui.nextWindowState.windowFlags |= WindowFlags.FixedPosition; } static setNextWindowNoBackground(isNoBackground: boolean) { @@ -100,8 +99,8 @@ export class Ui { return Ui.nextWindowState.spacing ?? Ui.style.window.spacing; } - static isWindowNoDrag(): boolean { - return !!(Ui.nextWindowState.windowFlags & WindowFlags.NoDrag); + static isWindowPositionFixed(): boolean { + return !!(Ui.nextWindowState.windowFlags & WindowFlags.FixedPosition); } static isWindowNoBackground(): boolean { @@ -229,7 +228,7 @@ export class Ui { } private beginWindowDrag() { - if (Ui.isWindowNoDrag() || Ui.isWindowInputDisabled()) return; + if (Ui.isWindowPositionFixed() || Ui.isWindowInputDisabled()) return; const mousePosition = this.input.getMousePosition();