* @function * @memberof Modifiers * @argument {Object} data - The data object generated by update method * @argument {Object} options - Modifiers configuration and options * @returns {Object} The data object, properly modified
(data)
| 4912 | |
| 4913 | |
| 4914 | function hide(data) { |
| 4915 | if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) { |
| 4916 | return data; |
| 4917 | } |
| 4918 | |
| 4919 | var refRect = data.offsets.reference; |
| 4920 | var bound = find(data.instance.modifiers, function (modifier) { |
| 4921 | return modifier.name === 'preventOverflow'; |
| 4922 | }).boundaries; |
| 4923 | |
| 4924 | if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { |
| 4925 | // Avoid unnecessary DOM access if visibility hasn't changed |
| 4926 | if (data.hide === true) { |
| 4927 | return data; |
| 4928 | } |
| 4929 | |
| 4930 | data.hide = true; |
| 4931 | data.attributes['x-out-of-boundaries'] = ''; |
| 4932 | } else { |
| 4933 | // Avoid unnecessary DOM access if visibility hasn't changed |
| 4934 | if (data.hide === false) { |
| 4935 | return data; |
| 4936 | } |
| 4937 | |
| 4938 | data.hide = false; |
| 4939 | data.attributes['x-out-of-boundaries'] = false; |
| 4940 | } |
| 4941 | |
| 4942 | return data; |
| 4943 | } |
| 4944 | /** |
| 4945 | * @function |
| 4946 | * @memberof Modifiers |
nothing calls this directly
no test coverage detected
searching dependent graphs…