Allowing the dialog to get the position from browser events

This commit is contained in:
Bruno Alves de Faria 2017-03-30 15:10:05 -03:00
parent 66dfefbb14
commit 749c863183

View File

@ -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);
}