publ-echo-test 0.0.37 → 0.0.39

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.
@@ -81,14 +81,13 @@ var GridItem = function (_a) {
81
81
  var _a = calcWH(getPositionParams(), {
82
82
  width: width,
83
83
  height: height,
84
- }, x, y, 'e', props.w, props.h, true), w_1 = _a.w, h_1 = _a.h;
84
+ }, x, y, 'e', props.w, props.h, false), w_1 = _a.w, h_1 = _a.h;
85
85
  if (keepWidth) {
86
86
  w_1 = prevW;
87
87
  }
88
88
  if (prevH > h_1) {
89
89
  h_1 = prevH;
90
90
  }
91
- console.log('keep width?', keepWidth);
92
91
  var _b = getResizableXYPosition('e', w_1, h_1, prevW, prevH), newX = _b.newX, newY = _b.newY;
93
92
  if (prevH === h_1 && prevW === w_1 && newX === x && newY === y) {
94
93
  return;
@@ -378,6 +377,12 @@ var GridItem = function (_a) {
378
377
  h = clamp(h, tempMinH, maxH);
379
378
  setResizing(handlerName === "onResizeStop" ? undefined : size);
380
379
  var _d = getResizableXYPosition(handle, w, h, prevW, prevH), newX = _d.newX, newY = _d.newY;
380
+ // NOTE: test to fix
381
+ if (handle === 'nw' || handle === 'ne' || handle === 'sw' || handle === 'se') {
382
+ if (prevH === h) {
383
+ newX = x;
384
+ }
385
+ }
381
386
  handler(i, w, h, { e: e, node: node, size: size }, newX, newY);
382
387
  };
383
388
  var pos = calcGridItemPosition(getPositionParams(), x, y, z, w, h, {
@@ -59,7 +59,7 @@ export function calcWH(positionParams, _a, x, y, handleAxis, prevW, prevH, shoul
59
59
  var rowHeightNumber = resolveRowHeight(rowHeight, colWidth);
60
60
  var roundOrCeil = shouldCeil ? Math.ceil : Math.round;
61
61
  var w = roundOrCeil((width + margin[0]) / (colWidth + margin[0]));
62
- var h = roundOrCeil((height + margin[1]) / (rowHeightNumber + margin[1]));
62
+ var h = roundOrCeil(roundToOneDecimal((height + margin[1]) / (rowHeightNumber + margin[1])));
63
63
  // // Capping
64
64
  // w = clamp(w, 0, cols - x);
65
65
  // h = clamp(h, 0, maxRows - y);
@@ -107,3 +107,6 @@ export function calcWH(positionParams, _a, x, y, handleAxis, prevW, prevH, shoul
107
107
  export function clamp(num, lowerBound, upperBound) {
108
108
  return Math.max(Math.min(num, upperBound), lowerBound);
109
109
  }
110
+ function roundToOneDecimal(num) {
111
+ return Math.floor(num * 10) / 10;
112
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.37",
3
+ "version": "0.0.39",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",