react-resizable 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/Resizable.js +5 -11
- package/package.json +1 -1
package/build/Resizable.js
CHANGED
|
@@ -44,18 +44,12 @@ class Resizable extends React.Component {
|
|
|
44
44
|
// If constraining to min and max, we need to also fit width and height to aspect ratio.
|
|
45
45
|
if (lockAspectRatio) {
|
|
46
46
|
const ratio = this.props.width / this.props.height;
|
|
47
|
-
const deltaW = width - this.props.width;
|
|
48
|
-
const deltaH = height - this.props.height;
|
|
49
47
|
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
height = width / ratio;
|
|
56
|
-
} else {
|
|
57
|
-
width = height * ratio;
|
|
58
|
-
}
|
|
48
|
+
// Project (width, height) onto the line w = ratio * h.
|
|
49
|
+
// Distributes tracking error across both axes instead of forcing one to overshoot.
|
|
50
|
+
// t = (w * ratio + h) / (ratio^2 + 1), new_w = t * ratio, new_h = t
|
|
51
|
+
height = (width * ratio + height) / (ratio * ratio + 1);
|
|
52
|
+
width = height * ratio;
|
|
59
53
|
}
|
|
60
54
|
const oldW = width,
|
|
61
55
|
oldH = height;
|