Fixing multi-level dropdown issues with window boundaries
This commit is contained in:
1 parent
e4622aee2d
commit
0cd4714f1a
2 files changed
+35
-5
No files matched your search
@@ -4,3 +4,25 @@ import { Meteor } from 'meteor/meteor';
|
||||
// Get the UI settings
|
||||
const ui = Meteor.settings && Meteor.settings.public && Meteor.settings.public.ui;
|
||||
OHIF.uiSettings = ui || {};
|
||||
|
||||
/**
|
||||
* Get the offset for the given element
|
||||
*
|
||||
* @param {Object} element DOM element which will have the offser calculated
|
||||
* @returns {Object} Object containing the top and left offset
|
||||
*/
|
||||
OHIF.ui.getOffset = element => {
|
||||
let top = 0;
|
||||
let left = 0;
|
||||
if (element.offsetParent) {
|
||||
do {
|
||||
left += element.offsetLeft;
|
||||
top += element.offsetTop;
|
||||
} while (element = element.offsetParent);
|
||||
}
|
||||
|
||||
return {
|
||||
left,
|
||||
top
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user