react-sync-board 0.5.1 → 0.5.4

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/dist/cjs/index.js CHANGED
@@ -7399,14 +7399,7 @@ var useItemInteraction = function useItemInteraction(interaction) {
7399
7399
  var setInteractions = recoil.useSetRecoilState(ItemInteractionsAtom);
7400
7400
  var register = React__default['default'].useCallback(function (callback) {
7401
7401
  setInteractions(function (prev) {
7402
- if (!prev[interaction]) {
7403
- // eslint-disable-next-line no-param-reassign
7404
- prev[interaction] = [];
7405
- }
7406
-
7407
- var newInter = _toConsumableArray(prev[interaction]);
7408
-
7409
- newInter.push(callback);
7402
+ var newInter = Array.isArray(prev[interaction]) ? [].concat(_toConsumableArray(prev[interaction]), [callback]) : [callback];
7410
7403
  return _objectSpread2(_objectSpread2({}, prev), {}, _defineProperty({}, interaction, newInter));
7411
7404
  });
7412
7405
  return function () {
@@ -7646,8 +7639,14 @@ var useItemActions = function useItemActions() {
7646
7639
 
7647
7640
  var _ref7 = item.grid || {},
7648
7641
  itemType = _ref7.type,
7649
- itemSize = _ref7.size;
7650
-
7642
+ itemSize = _ref7.size,
7643
+ _ref7$offset = _ref7.offset;
7644
+
7645
+ _ref7$offset = _ref7$offset === void 0 ? {} : _ref7$offset;
7646
+ var _ref7$offset$x = _ref7$offset.x,
7647
+ offsetX = _ref7$offset$x === void 0 ? 0 : _ref7$offset$x,
7648
+ _ref7$offset$y = _ref7$offset.y,
7649
+ offsetY = _ref7$offset$y === void 0 ? 0 : _ref7$offset$y;
7651
7650
  var type = globalType;
7652
7651
  var size = globalSize || 1; // If item specific
7653
7652
 
@@ -7722,8 +7721,8 @@ var useItemActions = function useItemActions() {
7722
7721
  }
7723
7722
 
7724
7723
  result[id] = _objectSpread2(_objectSpread2({}, item), {}, {
7725
- x: newX - elem.clientWidth / 2,
7726
- y: newY - elem.clientHeight / 2
7724
+ x: newX + offsetX - elem.clientWidth / 2,
7725
+ y: newY + offsetY - elem.clientHeight / 2
7727
7726
  });
7728
7727
  updatedItems[id] = result[id];
7729
7728
  });
@@ -8059,7 +8058,6 @@ var useItemActions = function useItemActions() {
8059
8058
  _ref19$passLocked,
8060
8059
  passLocked,
8061
8060
  foundElement,
8062
- isPassthrough,
8063
8061
  itemList,
8064
8062
  _yield$snapshot$getPr2,
8065
8063
  boardWrapper,
@@ -8086,35 +8084,40 @@ var useItemActions = function useItemActions() {
8086
8084
  foundElement = insideClass(target, "item");
8087
8085
 
8088
8086
  if (!foundElement) {
8089
- _context8.next = 27;
8087
+ _context8.next = 28;
8090
8088
  break;
8091
8089
  }
8092
8090
 
8093
- if (!(!passLocked && hasClass(foundElement, "locked") && !hasClass(foundElement, "selected"))) {
8091
+ if (!hasClass(foundElement, "selected")) {
8094
8092
  _context8.next = 8;
8095
8093
  break;
8096
8094
  }
8097
8095
 
8098
- return _context8.abrupt("return", null);
8096
+ return _context8.abrupt("return", foundElement);
8099
8097
 
8100
8098
  case 8:
8101
- // Is it a passthrough element?
8102
- isPassthrough = (hasClass(target, "passthrough") || !returnLocked && hasClass(foundElement, "locked")) && !hasClass(foundElement, "selected");
8099
+ if (!(!passLocked && hasClass(foundElement, "locked") && !hasClass(target, "passthrough"))) {
8100
+ _context8.next = 10;
8101
+ break;
8102
+ }
8103
8103
 
8104
- if (!isPassthrough) {
8105
- _context8.next = 27;
8104
+ return _context8.abrupt("return", returnLocked ? foundElement : null);
8105
+
8106
+ case 10:
8107
+ if (!hasClass(target, "passthrough")) {
8108
+ _context8.next = 28;
8106
8109
  break;
8107
8110
  }
8108
8111
 
8109
- _context8.next = 12;
8112
+ _context8.next = 13;
8110
8113
  return snapshot.getPromise(ItemListAtom);
8111
8114
 
8112
- case 12:
8115
+ case 13:
8113
8116
  itemList = _context8.sent;
8114
- _context8.next = 15;
8117
+ _context8.next = 16;
8115
8118
  return snapshot.getPromise(ConfigurationAtom);
8116
8119
 
8117
- case 15:
8120
+ case 16:
8118
8121
  _yield$snapshot$getPr2 = _context8.sent;
8119
8122
  boardWrapper = _yield$snapshot$getPr2.boardWrapper;
8120
8123
  // Found element under the cursor
@@ -8134,33 +8137,33 @@ var useItemActions = function useItemActions() {
8134
8137
 
8135
8138
  i = 0;
8136
8139
 
8137
- case 19:
8140
+ case 20:
8138
8141
  if (!(i < elems.length)) {
8139
- _context8.next = 26;
8142
+ _context8.next = 27;
8140
8143
  break;
8141
8144
  }
8142
8145
 
8143
8146
  elem = elems[i];
8144
8147
 
8145
- if (!(elem !== foundElement && (returnLocked || !hasClass(elem, "locked")))) {
8146
- _context8.next = 23;
8148
+ if (!(elem !== foundElement && (passLocked || !hasClass(elem, "locked")))) {
8149
+ _context8.next = 24;
8147
8150
  break;
8148
8151
  }
8149
8152
 
8150
8153
  return _context8.abrupt("return", elem);
8151
8154
 
8152
- case 23:
8155
+ case 24:
8153
8156
  i += 1;
8154
- _context8.next = 19;
8157
+ _context8.next = 20;
8155
8158
  break;
8156
8159
 
8157
- case 26:
8160
+ case 27:
8158
8161
  return _context8.abrupt("return", null);
8159
8162
 
8160
- case 27:
8163
+ case 28:
8161
8164
  return _context8.abrupt("return", foundElement);
8162
8165
 
8163
- case 28:
8166
+ case 29:
8164
8167
  case "end":
8165
8168
  return _context8.stop();
8166
8169
  }