react-resizable-box
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -83,7 +83,2 @@ 'use strict'; | ||
height: 0 | ||
}, | ||
// offset is back door for rnd component | ||
offset: { | ||
x: 0, | ||
y: 0 | ||
} | ||
@@ -210,4 +205,12 @@ }; | ||
if (parent instanceof HTMLElement) { | ||
var boundWidth = parent.offsetWidth + (parent.offsetLeft - this.resizable.offsetLeft) - this.state.offset.x; | ||
var boundHeight = parent.offsetHeight + (parent.offsetTop - this.resizable.offsetTop) - this.state.offset.y; | ||
var parentRect = parent.getBoundingClientRect(); | ||
var parentLeft = parentRect.left; | ||
var parentTop = parentRect.top; | ||
var _resizable$getBoundin = this.resizable.getBoundingClientRect(), | ||
_left = _resizable$getBoundin.left, | ||
_top = _resizable$getBoundin.top; | ||
var boundWidth = parent.offsetWidth + (parentLeft - _left); | ||
var boundHeight = parent.offsetHeight + (parentTop - _top); | ||
maxWidth = maxWidth && maxWidth < boundWidth ? maxWidth : boundWidth; | ||
@@ -218,10 +221,23 @@ maxHeight = maxHeight && maxHeight < boundHeight ? maxHeight : boundHeight; | ||
if (typeof window !== 'undefined') { | ||
var _boundWidth = window.innerWidth - this.resizable.offsetLeft - this.state.offset.x; | ||
var _boundHeight = window.innerHeight - this.resizable.offsetTop - this.state.offset.y; | ||
var _resizable$getBoundin2 = this.resizable.getBoundingClientRect(), | ||
_left2 = _resizable$getBoundin2.left, | ||
_top2 = _resizable$getBoundin2.top; | ||
var _boundWidth = window.innerWidth - _left2; | ||
var _boundHeight = window.innerHeight - _top2; | ||
maxWidth = maxWidth && maxWidth < _boundWidth ? maxWidth : _boundWidth; | ||
maxHeight = maxHeight && maxHeight < _boundHeight ? maxHeight : _boundHeight; | ||
} | ||
} else if (this.props.bounds && this.props.bounds instanceof HTMLElement) { | ||
var _boundWidth2 = this.props.bounds.offsetWidth + (this.props.bounds.offsetLeft - this.resizable.offsetLeft) - this.state.offset.x; | ||
var _boundHeight2 = this.props.bounds.offsetHeight + (this.props.bounds.offsetTop - this.resizable.offsetTop) - this.state.offset.y; | ||
} else if (this.props.bounds instanceof HTMLElement) { | ||
var targetRect = this.props.bounds.getBoundingClientRect(); | ||
var targetLeft = targetRect.left; | ||
var targetTop = targetRect.top; | ||
var _resizable$getBoundin3 = this.resizable.getBoundingClientRect(), | ||
_left3 = _resizable$getBoundin3.left, | ||
_top3 = _resizable$getBoundin3.top; | ||
if (!(this.props.bounds instanceof HTMLElement)) return; | ||
var _boundWidth2 = this.props.bounds.offsetWidth + (targetLeft - _left3); | ||
var _boundHeight2 = this.props.bounds.offsetHeight + (targetTop - _top3); | ||
maxWidth = maxWidth && maxWidth < _boundWidth2 ? maxWidth : _boundWidth2; | ||
@@ -339,3 +355,5 @@ maxHeight = maxHeight && maxHeight < _boundHeight2 ? maxHeight : _boundHeight2; | ||
position: 'relative' | ||
}, userSelect, style, this.style), | ||
}, userSelect, style, this.style, { | ||
boxSizing: 'border-box' | ||
}), | ||
className: className | ||
@@ -342,0 +360,0 @@ }, this.props.extendsProps), |
{ | ||
"name": "react-resizable-box", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -218,2 +218,8 @@ # react-resizable-box | ||
#### v2.0.2 | ||
- Remove offset state. | ||
- Use `border-box`. | ||
- Fix boundary size. | ||
#### v2.0.1 | ||
@@ -220,0 +226,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34138
553
350