react-sync-board 0.3.3 → 0.3.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 +186 -69
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +186 -69
- package/dist/esm/index.js.map +1 -1
- package/dist/react-sync-board.min.js +3 -3
- package/dist/react-sync-board.min.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -4697,7 +4697,7 @@ var es6 = function equal(a, b) {
|
|
|
4697
4697
|
|
|
4698
4698
|
var img = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:cc='http://creativecommons.org/ns%23' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:svg='http://www.w3.org/2000/svg' xmlns='http://www.w3.org/2000/svg' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' version='1.1' x='0px' y='0px' viewBox='0 0 75.601318 94.9' xml:space='preserve' id='svg26' sodipodi:docname='lock.svg' width='75.601318' height='94.900002' inkscape:version='0.92.5 (2060ec1f9f%2c 2020-04-08)'%3e%3cmetadata id='metadata32'%3e%3crdf:RDF%3e%3ccc:Work rdf:about=''%3e%3cdc:format%3eimage/svg%2bxml%3c/dc:format%3e%3cdc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage' /%3e%3cdc:title%3e%3c/dc:title%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs id='defs30' /%3e%3csodipodi:namedview pagecolor='black' bordercolor='%23666666' borderopacity='1' objecttolerance='10' gridtolerance='10' guidetolerance='10' inkscape:pageopacity='0' inkscape:pageshadow='2' inkscape:window-width='1848' inkscape:window-height='1016' id='namedview28' showgrid='false' fit-margin-top='0' fit-margin-left='0' fit-margin-right='0' fit-margin-bottom='0' inkscape:zoom='5.3400704' inkscape:cx='3.2640013' inkscape:cy='45.072152' inkscape:window-x='1512' inkscape:window-y='27' inkscape:window-maximized='1' inkscape:current-layer='g16' /%3e%3cg id='g16' transform='translate(-12.2%2c-2.5)'%3e%3cpath d='M 75.4%2c36.8 H 34.1 V 24.6 c 0%2c-8.8 7.1%2c-15.9 15.9%2c-15.9 8.8%2c0 15.9%2c7.1 15.9%2c15.9 0%2c1.7 1.4%2c3.1 3.1%2c3.1 1.7%2c0 3.1%2c-1.4 3.1%2c-3.1 C 72.1%2c12.4 62.2%2c2.5 50%2c2.5 37.8%2c2.5 27.9%2c12.4 27.9%2c24.6 v 12.2 h -3.3 c -6.9%2c0 -12.4%2c5.6 -12.4%2c12.4 V 85 c 0%2c6.9 5.6%2c12.4 12.4%2c12.4 h 50.8 c 6.9%2c0 12.4%2c-5.6 12.4%2c-12.4 V 49.2 C 87.9%2c42.3 82.3%2c36.8 75.4%2c36.8 Z m 6.2%2c48.3 c 0%2c3.4 -2.8%2c6.2 -6.2%2c6.2 H 24.6 c -3.4%2c0 -6.2%2c-2.8 -6.2%2c-6.2 V 49.2 c 0%2c-3.4 2.8%2c-6.2 6.2%2c-6.2 h 50.8 c 3.4%2c0 6.2%2c2.8 6.2%2c6.2 z' id='path12' inkscape:connector-curvature='0' style='fill:white%3bfill-opacity:1' /%3e%3cpath d='m 59.8%2c57.6 -12.5%2c12.5 -7%2c-7 c -1.2%2c-1.2 -3.2%2c-1.2 -4.4%2c0 -1.2%2c1.2 -1.2%2c3.2 0%2c4.4 l 9.2%2c9.2 c 0.6%2c0.6 1.4%2c0.9 2.2%2c0.9 0.8%2c0 1.6%2c-0.3 2.2%2c-0.9 L 64.2%2c62 c 1.2%2c-1.2 1.2%2c-3.2 0%2c-4.4 -1.2%2c-1.2 -3.2%2c-1.2 -4.4%2c0 z' id='path14' inkscape:connector-curvature='0' style='fill:white%3bfill-opacity:1' /%3e%3c/g%3e%3c/svg%3e";
|
|
4699
4699
|
|
|
4700
|
-
var _excluded$
|
|
4700
|
+
var _excluded$2 = ["type", "rotation", "id", "locked", "layer"],
|
|
4701
4701
|
_excluded2 = ["x", "y", "layer", "moving"],
|
|
4702
4702
|
_excluded3 = ["state"];
|
|
4703
4703
|
|
|
@@ -4707,23 +4707,101 @@ var ItemWrapper = newStyled.div(_templateObject$2 || (_templateObject$2 = _tagge
|
|
|
4707
4707
|
return rotation;
|
|
4708
4708
|
}, img);
|
|
4709
4709
|
|
|
4710
|
-
var
|
|
4711
|
-
var
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4710
|
+
var DefaultErrorComponent = function DefaultErrorComponent(_ref2) {
|
|
4711
|
+
var onReload = _ref2.onReload;
|
|
4712
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4713
|
+
style: {
|
|
4714
|
+
width: "100px",
|
|
4715
|
+
display: "flex",
|
|
4716
|
+
flexDirection: "column",
|
|
4717
|
+
justifyContent: "center",
|
|
4718
|
+
textAlign: "center",
|
|
4719
|
+
color: "red"
|
|
4720
|
+
},
|
|
4721
|
+
className: "syncboard-error-item"
|
|
4722
|
+
}, "Sorry, this item seems broken.", /*#__PURE__*/React__default['default'].createElement("button", {
|
|
4723
|
+
onClick: onReload
|
|
4724
|
+
}, "Reload it"));
|
|
4725
|
+
};
|
|
4726
|
+
/* Error boundary for broken item */
|
|
4727
|
+
|
|
4728
|
+
|
|
4729
|
+
var ItemErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
4730
|
+
_inherits(ItemErrorBoundary, _React$Component);
|
|
4731
|
+
|
|
4732
|
+
var _super = _createSuper(ItemErrorBoundary);
|
|
4733
|
+
|
|
4734
|
+
function ItemErrorBoundary(props) {
|
|
4735
|
+
var _this;
|
|
4736
|
+
|
|
4737
|
+
_classCallCheck(this, ItemErrorBoundary);
|
|
4738
|
+
|
|
4739
|
+
_this = _super.call(this, props);
|
|
4740
|
+
_this.state = {
|
|
4741
|
+
hasError: false,
|
|
4742
|
+
itemId: props.itemId
|
|
4743
|
+
};
|
|
4744
|
+
_this.onReload = _this.onReload.bind(_assertThisInitialized(_this));
|
|
4745
|
+
return _this;
|
|
4746
|
+
}
|
|
4747
|
+
|
|
4748
|
+
_createClass(ItemErrorBoundary, [{
|
|
4749
|
+
key: "componentDidCatch",
|
|
4750
|
+
value: function componentDidCatch(error) {
|
|
4751
|
+
// eslint-disable-next-line no-console
|
|
4752
|
+
console.log("Error for item ".concat(this.state.itemId), error, this.props.state);
|
|
4753
|
+
}
|
|
4754
|
+
}, {
|
|
4755
|
+
key: "onReload",
|
|
4756
|
+
value: function onReload() {
|
|
4757
|
+
this.setState({
|
|
4758
|
+
hasError: false
|
|
4759
|
+
});
|
|
4760
|
+
}
|
|
4761
|
+
}, {
|
|
4762
|
+
key: "render",
|
|
4763
|
+
value: function render() {
|
|
4764
|
+
var ErrorComponent = this.props.ErrorComponent;
|
|
4765
|
+
|
|
4766
|
+
if (this.state.hasError) {
|
|
4767
|
+
return /*#__PURE__*/React__default['default'].createElement(ErrorComponent, {
|
|
4768
|
+
onReload: this.onReload
|
|
4769
|
+
});
|
|
4770
|
+
}
|
|
4771
|
+
|
|
4772
|
+
return this.props.children;
|
|
4773
|
+
}
|
|
4774
|
+
}], [{
|
|
4775
|
+
key: "getDerivedStateFromError",
|
|
4776
|
+
value: function getDerivedStateFromError() {
|
|
4777
|
+
return {
|
|
4778
|
+
hasError: true
|
|
4779
|
+
};
|
|
4780
|
+
}
|
|
4781
|
+
}]);
|
|
4782
|
+
|
|
4783
|
+
return ItemErrorBoundary;
|
|
4784
|
+
}(React__default['default'].Component);
|
|
4785
|
+
|
|
4786
|
+
var Item = function Item(_ref3) {
|
|
4787
|
+
var _itemMap$error;
|
|
4788
|
+
|
|
4789
|
+
var setState = _ref3.setState,
|
|
4790
|
+
_ref3$state = _ref3.state;
|
|
4791
|
+
_ref3$state = _ref3$state === void 0 ? {} : _ref3$state;
|
|
4792
|
+
|
|
4793
|
+
var type = _ref3$state.type,
|
|
4794
|
+
_ref3$state$rotation = _ref3$state.rotation,
|
|
4795
|
+
rotation = _ref3$state$rotation === void 0 ? 0 : _ref3$state$rotation,
|
|
4796
|
+
id = _ref3$state.id,
|
|
4797
|
+
locked = _ref3$state.locked,
|
|
4798
|
+
layer = _ref3$state.layer,
|
|
4799
|
+
rest = _objectWithoutProperties(_ref3$state, _excluded$2),
|
|
4800
|
+
_ref3$animate = _ref3.animate,
|
|
4801
|
+
animate = _ref3$animate === void 0 ? "hvr-pop" : _ref3$animate,
|
|
4802
|
+
isSelected = _ref3.isSelected,
|
|
4803
|
+
itemMap = _ref3.itemMap,
|
|
4804
|
+
unlocked = _ref3.unlocked;
|
|
4727
4805
|
|
|
4728
4806
|
var isMountedRef = React__default['default'].useRef(false);
|
|
4729
4807
|
var animateRef = React__default['default'].useRef(null);
|
|
@@ -4773,10 +4851,15 @@ var Item = function Item(_ref2) {
|
|
|
4773
4851
|
onKeyUp: function onKeyUp(e) {
|
|
4774
4852
|
return e.stopPropagation();
|
|
4775
4853
|
}
|
|
4854
|
+
}, /*#__PURE__*/React__default['default'].createElement(ItemErrorBoundary, {
|
|
4855
|
+
itemId: id,
|
|
4856
|
+
state: rest,
|
|
4857
|
+
setState: updateState,
|
|
4858
|
+
ErrorComponent: (itemMap === null || itemMap === void 0 ? void 0 : (_itemMap$error = itemMap.error) === null || _itemMap$error === void 0 ? void 0 : _itemMap$error.component) || DefaultErrorComponent
|
|
4776
4859
|
}, /*#__PURE__*/React__default['default'].createElement(Component, _extends$1({}, rest, {
|
|
4777
4860
|
id: id,
|
|
4778
4861
|
setState: updateState
|
|
4779
|
-
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4862
|
+
}))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4780
4863
|
className: "corner top-left"
|
|
4781
4864
|
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4782
4865
|
className: "corner top-right"
|
|
@@ -4787,30 +4870,30 @@ var Item = function Item(_ref2) {
|
|
|
4787
4870
|
})));
|
|
4788
4871
|
};
|
|
4789
4872
|
|
|
4790
|
-
var MemoizedItem = /*#__PURE__*/React.memo(Item, function (
|
|
4791
|
-
var prevState =
|
|
4792
|
-
prevSetState =
|
|
4793
|
-
prevIsSelected =
|
|
4794
|
-
prevUnlocked =
|
|
4795
|
-
var nextState =
|
|
4796
|
-
nextSetState =
|
|
4797
|
-
nextIsSelected =
|
|
4798
|
-
nextUnlocked =
|
|
4873
|
+
var MemoizedItem = /*#__PURE__*/React.memo(Item, function (_ref4, _ref5) {
|
|
4874
|
+
var prevState = _ref4.state,
|
|
4875
|
+
prevSetState = _ref4.setState,
|
|
4876
|
+
prevIsSelected = _ref4.isSelected,
|
|
4877
|
+
prevUnlocked = _ref4.unlocked;
|
|
4878
|
+
var nextState = _ref5.state,
|
|
4879
|
+
nextSetState = _ref5.setState,
|
|
4880
|
+
nextIsSelected = _ref5.isSelected,
|
|
4881
|
+
nextUnlocked = _ref5.unlocked;
|
|
4799
4882
|
return prevIsSelected === nextIsSelected && prevUnlocked === nextUnlocked && prevSetState === nextSetState && JSON.stringify(prevState) === JSON.stringify(nextState);
|
|
4800
4883
|
}); // Exclude positionning from memoization
|
|
4801
4884
|
|
|
4802
|
-
var PositionedItem = function PositionedItem(
|
|
4803
|
-
var
|
|
4804
|
-
|
|
4885
|
+
var PositionedItem = function PositionedItem(_ref6) {
|
|
4886
|
+
var _ref6$state = _ref6.state;
|
|
4887
|
+
_ref6$state = _ref6$state === void 0 ? {} : _ref6$state;
|
|
4805
4888
|
|
|
4806
|
-
var
|
|
4807
|
-
x =
|
|
4808
|
-
|
|
4809
|
-
y =
|
|
4810
|
-
layer =
|
|
4811
|
-
moving =
|
|
4812
|
-
stateRest = _objectWithoutProperties(
|
|
4813
|
-
rest = _objectWithoutProperties(
|
|
4889
|
+
var _ref6$state$x = _ref6$state.x,
|
|
4890
|
+
x = _ref6$state$x === void 0 ? 0 : _ref6$state$x,
|
|
4891
|
+
_ref6$state$y = _ref6$state.y,
|
|
4892
|
+
y = _ref6$state$y === void 0 ? 0 : _ref6$state$y,
|
|
4893
|
+
layer = _ref6$state.layer,
|
|
4894
|
+
moving = _ref6$state.moving,
|
|
4895
|
+
stateRest = _objectWithoutProperties(_ref6$state, _excluded2),
|
|
4896
|
+
rest = _objectWithoutProperties(_ref6, _excluded3);
|
|
4814
4897
|
|
|
4815
4898
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4816
4899
|
style: {
|
|
@@ -6000,7 +6083,7 @@ var Selector = function Selector(_ref) {
|
|
|
6000
6083
|
var stateRef = React__default['default'].useRef({
|
|
6001
6084
|
moving: false
|
|
6002
6085
|
});
|
|
6003
|
-
var config = recoil.useRecoilValue(BoardConfigAtom); // Reset selection on
|
|
6086
|
+
var config = recoil.useRecoilValue(BoardConfigAtom); // Reset selection on board loading
|
|
6004
6087
|
|
|
6005
6088
|
React__default['default'].useEffect(function () {
|
|
6006
6089
|
setSelected(emptySelection);
|
|
@@ -6660,32 +6743,26 @@ function F(t) {
|
|
|
6660
6743
|
return w(t) > .179;
|
|
6661
6744
|
}
|
|
6662
6745
|
|
|
6746
|
+
var _excluded$1 = ["pos"];
|
|
6747
|
+
|
|
6663
6748
|
var _templateObject$1, _templateObject2;
|
|
6664
|
-
var StyledCursor = newStyled.div(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
return "translate(".concat(left, "px, ").concat(top, "px)");
|
|
6668
|
-
});
|
|
6669
|
-
var CursorName = newStyled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n color: ", ";\n font-weight: bold;\n padding: 0 0.5em;\n border-radius: 2px;\n max-width: 5em;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-left: -0.5em;\n margin-top: 1.7em;\n whitespace: nowrap;\n background-color: ", ";\n"])), function (_ref2) {
|
|
6670
|
-
var textColor = _ref2.textColor;
|
|
6749
|
+
var StyledCursor = newStyled.div(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n align-items: center;\n z-index: 210;\n"])));
|
|
6750
|
+
var CursorName = newStyled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n color: ", ";\n font-weight: bold;\n padding: 0 0.5em;\n border-radius: 2px;\n max-width: 5em;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-left: -0.5em;\n margin-top: 1.7em;\n whitespace: nowrap;\n background-color: ", ";\n"])), function (_ref) {
|
|
6751
|
+
var textColor = _ref.textColor;
|
|
6671
6752
|
return textColor;
|
|
6672
|
-
}, function (
|
|
6673
|
-
var color =
|
|
6753
|
+
}, function (_ref2) {
|
|
6754
|
+
var color = _ref2.color;
|
|
6674
6755
|
return color;
|
|
6675
6756
|
});
|
|
6676
6757
|
|
|
6677
|
-
var Cursor = function Cursor(
|
|
6678
|
-
var
|
|
6679
|
-
color =
|
|
6680
|
-
|
|
6681
|
-
size =
|
|
6682
|
-
|
|
6683
|
-
text = _ref4.text;
|
|
6758
|
+
var Cursor = function Cursor(_ref3) {
|
|
6759
|
+
var _ref3$color = _ref3.color,
|
|
6760
|
+
color = _ref3$color === void 0 ? "#666" : _ref3$color,
|
|
6761
|
+
_ref3$size = _ref3.size,
|
|
6762
|
+
size = _ref3$size === void 0 ? 40 : _ref3$size,
|
|
6763
|
+
text = _ref3.text;
|
|
6684
6764
|
var textColor = F(color) ? "#222" : "#EEE";
|
|
6685
|
-
return /*#__PURE__*/React__default['default'].createElement(StyledCursor, {
|
|
6686
|
-
top: pos.y - 10,
|
|
6687
|
-
left: pos.x - 5
|
|
6688
|
-
}, /*#__PURE__*/React__default['default'].createElement("svg", {
|
|
6765
|
+
return /*#__PURE__*/React__default['default'].createElement(StyledCursor, null, /*#__PURE__*/React__default['default'].createElement("svg", {
|
|
6689
6766
|
version: "1.1",
|
|
6690
6767
|
id: "Layer_1",
|
|
6691
6768
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6710,6 +6787,23 @@ var Cursor = function Cursor(_ref4) {
|
|
|
6710
6787
|
}, text));
|
|
6711
6788
|
};
|
|
6712
6789
|
|
|
6790
|
+
var MemoizedCursor = /*#__PURE__*/React__default['default'].memo(Cursor);
|
|
6791
|
+
|
|
6792
|
+
var PositionnedCursor = function PositionnedCursor(_ref4) {
|
|
6793
|
+
var pos = _ref4.pos,
|
|
6794
|
+
rest = _objectWithoutProperties(_ref4, _excluded$1);
|
|
6795
|
+
|
|
6796
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
6797
|
+
style: {
|
|
6798
|
+
transform: "translate(".concat(pos.x - 5, "px, ").concat(pos.y - 3, "px)"),
|
|
6799
|
+
top: 0,
|
|
6800
|
+
left: 0,
|
|
6801
|
+
zIndex: 210,
|
|
6802
|
+
position: "fixed"
|
|
6803
|
+
}
|
|
6804
|
+
}, /*#__PURE__*/React__default['default'].createElement(MemoizedCursor, rest));
|
|
6805
|
+
};
|
|
6806
|
+
|
|
6713
6807
|
var Cursors = function Cursors(_ref) {
|
|
6714
6808
|
var users = _ref.users;
|
|
6715
6809
|
|
|
@@ -6785,7 +6879,7 @@ var Cursors = function Cursors(_ref) {
|
|
|
6785
6879
|
userId = _ref5[0],
|
|
6786
6880
|
pos = _ref5[1];
|
|
6787
6881
|
|
|
6788
|
-
return /*#__PURE__*/React__default['default'].createElement(
|
|
6882
|
+
return /*#__PURE__*/React__default['default'].createElement(PositionnedCursor, {
|
|
6789
6883
|
key: userId,
|
|
6790
6884
|
pos: pos,
|
|
6791
6885
|
text: usersById[userId].name,
|
|
@@ -7324,7 +7418,12 @@ var PanZoomRotate = function PanZoomRotate(_ref) {
|
|
|
7324
7418
|
|
|
7325
7419
|
var config = recoil.useRecoilValue(BoardConfigAtom);
|
|
7326
7420
|
var setBoardState = recoil.useSetRecoilState(BoardStateAtom);
|
|
7327
|
-
var prevDim = usePrevious(dim);
|
|
7421
|
+
var prevDim = usePrevious(dim);
|
|
7422
|
+
var mouseRef = React__default['default'].useRef({
|
|
7423
|
+
hover: false,
|
|
7424
|
+
x: 0,
|
|
7425
|
+
y: 0
|
|
7426
|
+
}); // Hooks to save/restore position
|
|
7328
7427
|
|
|
7329
7428
|
usePositionNavigator();
|
|
7330
7429
|
|
|
@@ -7359,7 +7458,7 @@ var PanZoomRotate = function PanZoomRotate(_ref) {
|
|
|
7359
7458
|
translateY: prevDimension.translateY + deltaY
|
|
7360
7459
|
});
|
|
7361
7460
|
});
|
|
7362
|
-
}, [scale, setDim]); // Center board on
|
|
7461
|
+
}, [scale, setDim]); // Center board on board loading
|
|
7363
7462
|
|
|
7364
7463
|
React__default['default'].useEffect(function () {
|
|
7365
7464
|
var _boardRef$current$get = boardRef.current.getBoundingClientRect(),
|
|
@@ -7626,9 +7725,11 @@ var PanZoomRotate = function PanZoomRotate(_ref) {
|
|
|
7626
7725
|
e.preventDefault();
|
|
7627
7726
|
|
|
7628
7727
|
case 31:
|
|
7629
|
-
//
|
|
7728
|
+
// Temporary zoom
|
|
7630
7729
|
if (e.key === " " && !e.repeat) {
|
|
7631
|
-
|
|
7730
|
+
if (mouseRef.current.hover) {
|
|
7731
|
+
zoomTo(3, mouseRef.current);
|
|
7732
|
+
}
|
|
7632
7733
|
}
|
|
7633
7734
|
|
|
7634
7735
|
case 32:
|
|
@@ -7648,10 +7749,23 @@ var PanZoomRotate = function PanZoomRotate(_ref) {
|
|
|
7648
7749
|
// Ignore text in Input or Textarea
|
|
7649
7750
|
if (["INPUT", "TEXTAREA"].includes(e.target.tagName)) return; // Zoom out on release
|
|
7650
7751
|
|
|
7651
|
-
if (e.key === " ") {
|
|
7652
|
-
zoomTo(1 / 3);
|
|
7752
|
+
if (e.key === " " && mouseRef.current.hover) {
|
|
7753
|
+
zoomTo(1 / 3, mouseRef.current);
|
|
7653
7754
|
}
|
|
7654
|
-
}, [zoomTo]);
|
|
7755
|
+
}, [zoomTo]); // Save mouse position for temporary zoom
|
|
7756
|
+
|
|
7757
|
+
var onMouseMove = React__default['default'].useCallback(function (e) {
|
|
7758
|
+
var clientX = e.clientX,
|
|
7759
|
+
clientY = e.clientY;
|
|
7760
|
+
mouseRef.current.x = clientX;
|
|
7761
|
+
mouseRef.current.y = clientY;
|
|
7762
|
+
}, []);
|
|
7763
|
+
var onMouseEnter = React__default['default'].useCallback(function () {
|
|
7764
|
+
mouseRef.current.hover = true;
|
|
7765
|
+
}, []);
|
|
7766
|
+
var onMouseLeave = React__default['default'].useCallback(function () {
|
|
7767
|
+
mouseRef.current.hover = false;
|
|
7768
|
+
}, []);
|
|
7655
7769
|
React__default['default'].useEffect(function () {
|
|
7656
7770
|
document.addEventListener("keydown", onKeyDown);
|
|
7657
7771
|
document.addEventListener("keyup", onKeyUp);
|
|
@@ -7674,7 +7788,10 @@ var PanZoomRotate = function PanZoomRotate(_ref) {
|
|
|
7674
7788
|
ref: wrappedRef,
|
|
7675
7789
|
onContextMenu: function onContextMenu(e) {
|
|
7676
7790
|
e.preventDefault();
|
|
7677
|
-
}
|
|
7791
|
+
},
|
|
7792
|
+
onMouseMove: onMouseMove,
|
|
7793
|
+
onMouseEnter: onMouseEnter,
|
|
7794
|
+
onMouseLeave: onMouseLeave
|
|
7678
7795
|
}, children));
|
|
7679
7796
|
};
|
|
7680
7797
|
|