react-sync-board 0.4.4 → 0.4.5
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 +25 -17
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +25 -18
- package/dist/esm/index.js.map +1 -1
- package/dist/react-sync-board.min.js +1 -1
- package/dist/react-sync-board.min.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -7028,10 +7028,16 @@ var useDim = function useDim() {
|
|
|
7028
7028
|
var _useRecoilValue = useRecoilValue(ConfigurationAtom),
|
|
7029
7029
|
itemExtentGlobal = _useRecoilValue.itemExtent;
|
|
7030
7030
|
|
|
7031
|
-
var
|
|
7031
|
+
var getDim = useRecoilCallback(function (_ref2) {
|
|
7032
7032
|
var snapshot = _ref2.snapshot;
|
|
7033
|
+
return function () {
|
|
7034
|
+
return snapshot.getPromise(BoardTransformAtom);
|
|
7035
|
+
};
|
|
7036
|
+
}, []);
|
|
7037
|
+
var setDimSafe = useRecoilCallback(function (_ref3) {
|
|
7038
|
+
var snapshot = _ref3.snapshot;
|
|
7033
7039
|
return /*#__PURE__*/function () {
|
|
7034
|
-
var
|
|
7040
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(fn) {
|
|
7035
7041
|
var _yield$snapshot$getPr, itemExtent, boardWrapperRect, boardSize;
|
|
7036
7042
|
|
|
7037
7043
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -7103,14 +7109,14 @@ var useDim = function useDim() {
|
|
|
7103
7109
|
}));
|
|
7104
7110
|
|
|
7105
7111
|
return function (_x) {
|
|
7106
|
-
return
|
|
7112
|
+
return _ref4.apply(this, arguments);
|
|
7107
7113
|
};
|
|
7108
7114
|
}();
|
|
7109
7115
|
}, [setDim]);
|
|
7110
|
-
var zoomTo = useRecoilCallback(function (
|
|
7111
|
-
var snapshot =
|
|
7116
|
+
var zoomTo = useRecoilCallback(function (_ref5) {
|
|
7117
|
+
var snapshot = _ref5.snapshot;
|
|
7112
7118
|
return /*#__PURE__*/function () {
|
|
7113
|
-
var
|
|
7119
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(factor, zoomCenter) {
|
|
7114
7120
|
var _yield$snapshot$getPr2, itemExtent, boardWrapperRect, boardSize, center;
|
|
7115
7121
|
|
|
7116
7122
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
@@ -7182,12 +7188,12 @@ var useDim = function useDim() {
|
|
|
7182
7188
|
}));
|
|
7183
7189
|
|
|
7184
7190
|
return function (_x2, _x3) {
|
|
7185
|
-
return
|
|
7191
|
+
return _ref6.apply(this, arguments);
|
|
7186
7192
|
};
|
|
7187
7193
|
}();
|
|
7188
7194
|
}, [setDim]);
|
|
7189
|
-
var updateScaleBoundaries = useRecoilCallback(function (
|
|
7190
|
-
var snapshot =
|
|
7195
|
+
var updateScaleBoundaries = useRecoilCallback(function (_ref7) {
|
|
7196
|
+
var snapshot = _ref7.snapshot;
|
|
7191
7197
|
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
7192
7198
|
var _yield$snapshot$getPr3, _yield$snapshot$getPr4, width, height, boardWrapperRect, scaleX, scaleY, newScale;
|
|
7193
7199
|
|
|
@@ -7217,8 +7223,8 @@ var useDim = function useDim() {
|
|
|
7217
7223
|
}, _callee3);
|
|
7218
7224
|
}));
|
|
7219
7225
|
}, []);
|
|
7220
|
-
var getCenterCoordinates = useRecoilCallback(function (
|
|
7221
|
-
var snapshot =
|
|
7226
|
+
var getCenterCoordinates = useRecoilCallback(function (_ref9) {
|
|
7227
|
+
var snapshot = _ref9.snapshot;
|
|
7222
7228
|
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
|
|
7223
7229
|
var _yield$snapshot$getPr5, boardWrapperRect, boardSize, _yield$snapshot$getPr6, translateX, translateY, scale;
|
|
7224
7230
|
|
|
@@ -7254,11 +7260,11 @@ var useDim = function useDim() {
|
|
|
7254
7260
|
}, _callee4);
|
|
7255
7261
|
}));
|
|
7256
7262
|
}, []);
|
|
7257
|
-
var updateItemExtent = useRecoilCallback(function (
|
|
7258
|
-
var snapshot =
|
|
7259
|
-
set =
|
|
7263
|
+
var updateItemExtent = useRecoilCallback(function (_ref11) {
|
|
7264
|
+
var snapshot = _ref11.snapshot,
|
|
7265
|
+
set = _ref11.set;
|
|
7260
7266
|
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
|
|
7261
|
-
var itemIds, _yield$snapshot$getPr7, boardWrapperRect, boardWrapper, boardSize, _yield$snapshot$getPr8, scale, translateX, translateY,
|
|
7267
|
+
var itemIds, _yield$snapshot$getPr7, boardWrapperRect, boardWrapper, boardSize, _yield$snapshot$getPr8, scale, translateX, translateY, _ref13, left, top, width, height, relativeExtent, delta, _delta;
|
|
7262
7268
|
|
|
7263
7269
|
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
7264
7270
|
while (1) {
|
|
@@ -7285,12 +7291,12 @@ var useDim = function useDim() {
|
|
|
7285
7291
|
scale = _yield$snapshot$getPr8.scale;
|
|
7286
7292
|
translateX = _yield$snapshot$getPr8.translateX;
|
|
7287
7293
|
translateY = _yield$snapshot$getPr8.translateY;
|
|
7288
|
-
|
|
7294
|
+
_ref13 = getItemBoundingBox(itemIds, boardWrapper) || {
|
|
7289
7295
|
left: boardSize / 2 * scale + boardWrapperRect.left + translateX,
|
|
7290
7296
|
top: boardSize / 2 * scale + boardWrapperRect.top + translateY,
|
|
7291
7297
|
width: 0,
|
|
7292
7298
|
height: 0
|
|
7293
|
-
}, left =
|
|
7299
|
+
}, left = _ref13.left, top = _ref13.top, width = _ref13.width, height = _ref13.height;
|
|
7294
7300
|
relativeExtent = {
|
|
7295
7301
|
left: (left - boardWrapperRect.left - translateX) / scale,
|
|
7296
7302
|
top: (top - boardWrapperRect.top - translateY) / scale,
|
|
@@ -7336,6 +7342,7 @@ var useDim = function useDim() {
|
|
|
7336
7342
|
}, [updateScaleBoundaries, itemExtentGlobal]);
|
|
7337
7343
|
return {
|
|
7338
7344
|
setDim: setDimSafe,
|
|
7345
|
+
getDim: getDim,
|
|
7339
7346
|
zoomTo: zoomTo,
|
|
7340
7347
|
getCenter: getCenterCoordinates,
|
|
7341
7348
|
updateItemExtent: debouncedUpdateItemExtent
|
|
@@ -8931,5 +8938,5 @@ var ConnectedSyncRoom = function ConnectedSyncRoom(_ref) {
|
|
|
8931
8938
|
}, /*#__PURE__*/React.createElement(SubscribeUserEvents, null), children));
|
|
8932
8939
|
};
|
|
8933
8940
|
|
|
8934
|
-
export { Board, ConnectedSyncBoard as BoardWrapper, ConnectedSyncRoom as RoomWrapper, useAvailableActions, useBoardConfig, useBoardState, useItemActions, useItemInteraction, useItemList as useItems, useMessage, useSelectedItems, useSelectionBox, useUsers, useWire };
|
|
8941
|
+
export { Board, ConnectedSyncBoard as BoardWrapper, ConnectedSyncRoom as RoomWrapper, useAvailableActions, useBoardConfig, useDim as useBoardPosition, useBoardState, useItemActions, useItemInteraction, useItemList as useItems, useMessage, useSelectedItems, useSelectionBox, useUsers, useWire };
|
|
8935
8942
|
//# sourceMappingURL=index.js.map
|