Fixed an issue with a horiziontal scrollbar popping with a popover on displayed on the right side
This commit is contained in:
parent
5c51429abd
commit
b26eb2ebe4
|
@ -168,7 +168,8 @@ Node.prototype.setError = function (error, child) {
|
|||
|
||||
var contentRect = this.editor.content.getBoundingClientRect();
|
||||
var popoverRect = popover.getBoundingClientRect();
|
||||
var fit = util.insideRect(contentRect, popoverRect);
|
||||
var margin = 20; // account for a scroll bar
|
||||
var fit = util.insideRect(contentRect, popoverRect, margin);
|
||||
|
||||
if (fit) {
|
||||
break;
|
||||
|
|
|
@ -664,12 +664,14 @@ exports.parsePath = function parsePath(jsonPath) {
|
|||
* Test whether the child rect fits completely inside the parent rect.
|
||||
* @param {ClientRect} parent
|
||||
* @param {ClientRect} child
|
||||
* @param {number} margin
|
||||
*/
|
||||
exports.insideRect = function (parent, child) {
|
||||
return child.left >= parent.left
|
||||
&& child.right <= parent.right
|
||||
&& child.top >= parent.top
|
||||
&& child.bottom <= parent.bottom;
|
||||
exports.insideRect = function (parent, child, margin) {
|
||||
var _margin = margin !== undefined ? margin : 0;
|
||||
return child.left - _margin >= parent.left
|
||||
&& child.right + _margin <= parent.right
|
||||
&& child.top - _margin >= parent.top
|
||||
&& child.bottom + _margin <= parent.bottom;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -48,6 +48,9 @@
|
|||
"lastName": {
|
||||
"type": "string"
|
||||
},
|
||||
"gender": {
|
||||
"enum": ["male", "female"]
|
||||
},
|
||||
"age": {
|
||||
"description": "Age in years",
|
||||
"type": "integer",
|
||||
|
@ -75,6 +78,7 @@
|
|||
var json = {
|
||||
"firstName": "Jos",
|
||||
"lastName": "de Jong",
|
||||
gender: null,
|
||||
"age": 34.2,
|
||||
"hobbies": [
|
||||
"programming",
|
||||
|
|
Loading…
Reference in New Issue