Skip to content

Commit

Permalink
Handle zIndex in TJSDialog / move to Position
Browse files Browse the repository at this point in the history
  • Loading branch information
typhonrt committed Feb 26, 2022
1 parent 0658163 commit a16bad9
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 32 deletions.
7 changes: 2 additions & 5 deletions _dist/application/SvelteApplication.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,16 +198,13 @@ export class SvelteApplication extends Application
}

/**
* Provide an override to set reactive z-index after calling super method.
* Provide an override to set this application as the active window regardless of z-index. Changes behaviour from
* Foundry core. This is important / used for instance in dialog key handling for left / right button selection.
*/
bringToTop()
{
super.bringToTop();

const z = document.defaultView.getComputedStyle(this.element[0]).zIndex;

this.reactive.zIndex = z === 'null' || z === null ? null : parseInt(z, 10);

ui.activeWindow = this;
}

Expand Down
8 changes: 4 additions & 4 deletions _dist/application/TJSDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ export class TJSDialog extends SvelteApplication
modalOptions,
popOut,
resizable,
zIndex,
transition,
zIndex,
buttons: deepMerge(mergedButtons, {
yes: {
callback: (html) =>
Expand Down Expand Up @@ -287,7 +287,7 @@ export class TJSDialog extends SvelteApplication
*
* @property {object} [transition] - Transition options for the dialog.
*
* @property {number|null} [zIndex] - A specific z-index for the dialog. *
* @property {number|null} [zIndex] - A specific z-index for the dialog.
*/

/**
Expand All @@ -305,7 +305,7 @@ export class TJSDialog extends SvelteApplication
*
* @property {boolean} [rejectClose=false] - Reject the Promise if the Dialog is closed without making a choice.
*
* @property {object} [options={}] - Additional rendering options passed to the Dialog
* @property {object} [options={}] - Additional application options passed to the TJSDialog.
*
* @property {boolean} [draggable=true] - The dialog is draggable when true.
*
Expand All @@ -321,5 +321,5 @@ export class TJSDialog extends SvelteApplication
*
* @property {object} [transition] - Transition options for the dialog.
*
* @property {number|null} [zIndex] - A specific z-index for the dialog. *
* @property {number|null} [zIndex] - A specific z-index for the dialog.
*/
7 changes: 2 additions & 5 deletions _dist/application/legacy/SvelteFormApplication.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,13 @@ export class SvelteFormApplication extends FormApplication
}

/**
* Provide an override to set reactive z-index after calling super method.
* Provide an override to set this application as the active window regardless of z-index. Changes behaviour from
* Foundry core. This is important / used for instance in dialog key handling for left / right button selection.
*/
bringToTop()
{
super.bringToTop();

const z = document.defaultView.getComputedStyle(this.element[0]).zIndex;

this.reactive.zIndex = z === 'null' || z === null ? null : parseInt(z, 10);

ui.activeWindow = this;
}

Expand Down
4 changes: 2 additions & 2 deletions _dist/component/core/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion _dist/component/core/index.js.map

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions src/application/SvelteApplication.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,16 +198,13 @@ export class SvelteApplication extends Application
}

/**
* Provide an override to set reactive z-index after calling super method.
* Provide an override to set this application as the active window regardless of z-index. Changes behaviour from
* Foundry core. This is important / used for instance in dialog key handling for left / right button selection.
*/
bringToTop()
{
super.bringToTop();

const z = document.defaultView.getComputedStyle(this.element[0]).zIndex;

this.reactive.zIndex = z === 'null' || z === null ? null : parseInt(z, 10);

ui.activeWindow = this;
}

Expand Down
8 changes: 4 additions & 4 deletions src/application/TJSDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ export class TJSDialog extends SvelteApplication
modalOptions,
popOut,
resizable,
zIndex,
transition,
zIndex,
buttons: deepMerge(mergedButtons, {
yes: {
callback: (html) =>
Expand Down Expand Up @@ -287,7 +287,7 @@ export class TJSDialog extends SvelteApplication
*
* @property {object} [transition] - Transition options for the dialog.
*
* @property {number|null} [zIndex] - A specific z-index for the dialog. *
* @property {number|null} [zIndex] - A specific z-index for the dialog.
*/

/**
Expand All @@ -305,7 +305,7 @@ export class TJSDialog extends SvelteApplication
*
* @property {boolean} [rejectClose=false] - Reject the Promise if the Dialog is closed without making a choice.
*
* @property {object} [options={}] - Additional rendering options passed to the Dialog
* @property {object} [options={}] - Additional application options passed to the TJSDialog.
*
* @property {boolean} [draggable=true] - The dialog is draggable when true.
*
Expand All @@ -321,5 +321,5 @@ export class TJSDialog extends SvelteApplication
*
* @property {object} [transition] - Transition options for the dialog.
*
* @property {number|null} [zIndex] - A specific z-index for the dialog. *
* @property {number|null} [zIndex] - A specific z-index for the dialog.
*/
7 changes: 2 additions & 5 deletions src/application/legacy/SvelteFormApplication.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,13 @@ export class SvelteFormApplication extends FormApplication
}

/**
* Provide an override to set reactive z-index after calling super method.
* Provide an override to set this application as the active window regardless of z-index. Changes behaviour from
* Foundry core. This is important / used for instance in dialog key handling for left / right button selection.
*/
bringToTop()
{
super.bringToTop();

const z = document.defaultView.getComputedStyle(this.element[0]).zIndex;

this.reactive.zIndex = z === 'null' || z === null ? null : parseInt(z, 10);

ui.activeWindow = this;
}

Expand Down
2 changes: 1 addition & 1 deletion src/component/core/dialog/DialogShell.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
const newTitle = data.title ?? 'Dialog';
if (newTitle !== application?.options?.title) { application.reactive.title = newTitle; }
if (application.reactive.zIndex !== zIndex) { application.reactive.zIndex = zIndex; }
if (application.position.zIndex !== zIndex) { application.position.zIndex = zIndex; }
}
// ApplicationShell transition options ----------------------------------------------------------------------------
Expand Down

0 comments on commit a16bad9

Please sign in to comment.