From 749c86318354a803ea7e473d5f594c4167333e1c Mon Sep 17 00:00:00 2001 From: Bruno Alves de Faria Date: Thu, 30 Mar 2017 15:10:05 -0300 Subject: [PATCH] Allowing the dialog to get the position from browser events --- .../client/components/bootstrap/dialog/form.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/form.js b/Packages/ohif-core/client/components/bootstrap/dialog/form.js index fa57dd5d5..99216760a 100644 --- a/Packages/ohif-core/client/components/bootstrap/dialog/form.js +++ b/Packages/ohif-core/client/components/bootstrap/dialog/form.js @@ -55,7 +55,17 @@ Template.dialogForm.onRendered(() => { // Create the bootstrap modal $modal.modal(modalOptions); - const position = instance.data.position; + // Check if dialog will be repositioned + let position = instance.data.position; + const event = instance.data.event; + if (!position && event && event.clientX) { + position = { + x: event.clientX, + y: event.clientY + }; + } + + // Reposition dialog if position object was filled if (position) { OHIF.ui.repositionDialog($modal, position.x, position.y); }