@rpg-engine/long-bow 0.8.16 → 0.8.18
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/long-bow.cjs.development.js +44 -7
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +44 -7
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CraftBook/CraftBook.tsx +1 -1
- package/src/components/CraftBook/CraftingTooltip.tsx +45 -14
|
@@ -28677,10 +28677,11 @@ var modifyString = function modifyString(str) {
|
|
|
28677
28677
|
return modifiedWords.join(' ');
|
|
28678
28678
|
};
|
|
28679
28679
|
|
|
28680
|
+
var OFFSET = 20;
|
|
28680
28681
|
var TooltipContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
28681
28682
|
displayName: "CraftingTooltip__TooltipContainer",
|
|
28682
28683
|
componentId: "sc-iqzgok-0"
|
|
28683
|
-
})(["position:fixed;left:", "px;top:", "px;background-color:rgba(0,0,0,0.95);color:white;text-align:left;border-radius:4px;padding:10px;z-index:1000;font-family:'Press Start 2P',cursive;font-size:0.6rem;width:max-content;max-width:250px;white-space:normal;border:1px solid ", ";box-shadow:0 2px 4px rgba(0,0,0,0.2);line-height:1.4
|
|
28684
|
+
})(["position:fixed;left:", "px;top:", "px;background-color:rgba(0,0,0,0.95);color:white;text-align:left;border-radius:4px;padding:10px;z-index:1000;font-family:'Press Start 2P',cursive;font-size:0.6rem;width:max-content;max-width:250px;white-space:normal;border:1px solid ", ";box-shadow:0 2px 4px rgba(0,0,0,0.2);line-height:1.4;"], function (props) {
|
|
28684
28685
|
return props.x;
|
|
28685
28686
|
}, function (props) {
|
|
28686
28687
|
return props.y;
|
|
@@ -28716,11 +28717,47 @@ var CraftingTooltip = function CraftingTooltip(_ref3) {
|
|
|
28716
28717
|
skills = _ref3.skills,
|
|
28717
28718
|
atlasIMG = _ref3.atlasIMG,
|
|
28718
28719
|
atlasJSON = _ref3.atlasJSON;
|
|
28720
|
+
var tooltipRef = React.useRef(null);
|
|
28721
|
+
var _React$useState = React__default.useState({
|
|
28722
|
+
x: x,
|
|
28723
|
+
y: y
|
|
28724
|
+
}),
|
|
28725
|
+
adjustedPosition = _React$useState[0],
|
|
28726
|
+
setAdjustedPosition = _React$useState[1];
|
|
28727
|
+
React.useEffect(function () {
|
|
28728
|
+
var tooltipElement = tooltipRef.current;
|
|
28729
|
+
if (tooltipElement) {
|
|
28730
|
+
var rect = tooltipElement.getBoundingClientRect();
|
|
28731
|
+
var tooltipWidth = rect.width;
|
|
28732
|
+
var tooltipHeight = rect.height;
|
|
28733
|
+
var adjustedX = x;
|
|
28734
|
+
var adjustedY = y;
|
|
28735
|
+
// If tooltip would go off the right edge, show it on the left side of the cursor
|
|
28736
|
+
if (x + tooltipWidth + OFFSET > window.innerWidth) {
|
|
28737
|
+
adjustedX = x - tooltipWidth - OFFSET;
|
|
28738
|
+
} else {
|
|
28739
|
+
// Otherwise, show it on the right side of the cursor
|
|
28740
|
+
adjustedX = x + OFFSET;
|
|
28741
|
+
}
|
|
28742
|
+
// Vertical positioning
|
|
28743
|
+
if (y + tooltipHeight > window.innerHeight) {
|
|
28744
|
+
adjustedY = window.innerHeight - tooltipHeight - OFFSET;
|
|
28745
|
+
}
|
|
28746
|
+
if (y < OFFSET) {
|
|
28747
|
+
adjustedY = OFFSET;
|
|
28748
|
+
}
|
|
28749
|
+
setAdjustedPosition({
|
|
28750
|
+
x: adjustedX,
|
|
28751
|
+
y: adjustedY
|
|
28752
|
+
});
|
|
28753
|
+
}
|
|
28754
|
+
}, [x, y]);
|
|
28719
28755
|
var levelInSkill = (_skills$level = skills == null ? void 0 : (_skills = skills[(_recipe$minCraftingRe = recipe == null ? void 0 : (_recipe$minCraftingRe2 = recipe.minCraftingRequirements) == null ? void 0 : _recipe$minCraftingRe2[0]) != null ? _recipe$minCraftingRe : '']) == null ? void 0 : _skills.level) != null ? _skills$level : 1;
|
|
28720
28756
|
var levelIsOk = (_recipe$levelIsOk = recipe == null ? void 0 : recipe.levelIsOk) != null ? _recipe$levelIsOk : false;
|
|
28721
28757
|
return React__default.createElement(TooltipContainer, {
|
|
28722
|
-
|
|
28723
|
-
|
|
28758
|
+
ref: tooltipRef,
|
|
28759
|
+
x: adjustedPosition.x,
|
|
28760
|
+
y: adjustedPosition.y
|
|
28724
28761
|
}, React__default.createElement(TooltipTitle, null, "Skill Requirements"), React__default.createElement(MinCraftingRequirementsText, {
|
|
28725
28762
|
levelIsOk: levelIsOk
|
|
28726
28763
|
}, modifyString("" + ((_recipe$minCraftingRe3 = recipe == null ? void 0 : (_recipe$minCraftingRe4 = recipe.minCraftingRequirements) == null ? void 0 : _recipe$minCraftingRe4[0]) != null ? _recipe$minCraftingRe3 : '')), " lvl", ' ', (_recipe$minCraftingRe5 = recipe == null ? void 0 : (_recipe$minCraftingRe6 = recipe.minCraftingRequirements) == null ? void 0 : _recipe$minCraftingRe6[1]) != null ? _recipe$minCraftingRe5 : 0, " (", levelInSkill, ")"), React__default.createElement(TooltipTitle, null, "Ingredients"), recipe.ingredients.map(function (ingredient, index) {
|
|
@@ -29101,7 +29138,7 @@ var SearchContainer$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
29101
29138
|
var ContentContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
29102
29139
|
displayName: "CraftBook__ContentContainer",
|
|
29103
29140
|
componentId: "sc-19q95ue-7"
|
|
29104
|
-
})(["flex:1;display:flex;flex-direction:column;padding:16px;padding-right:0;padding-bottom:0;width:100%;position:relative;min-height:
|
|
29141
|
+
})(["flex:1;display:flex;flex-direction:column;padding:16px;padding-right:0;padding-bottom:0;width:100%;position:relative;min-height:250px;overflow:hidden;"]);
|
|
29105
29142
|
var RadioInputScroller = /*#__PURE__*/styled__default.div.withConfig({
|
|
29106
29143
|
displayName: "CraftBook__RadioInputScroller",
|
|
29107
29144
|
componentId: "sc-19q95ue-8"
|
|
@@ -29483,7 +29520,7 @@ var useCursorPosition = function useCursorPosition(_ref) {
|
|
|
29483
29520
|
};
|
|
29484
29521
|
|
|
29485
29522
|
var CONTAINER_SIZE = 32;
|
|
29486
|
-
var OFFSET = CONTAINER_SIZE / 2;
|
|
29523
|
+
var OFFSET$1 = CONTAINER_SIZE / 2;
|
|
29487
29524
|
var DraggedItem = function DraggedItem(_ref) {
|
|
29488
29525
|
var _item$_id, _item$stackQty;
|
|
29489
29526
|
var atlasJSON = _ref.atlasJSON,
|
|
@@ -29503,8 +29540,8 @@ var DraggedItem = function DraggedItem(_ref) {
|
|
|
29503
29540
|
if (x === 0 && y === 0) {
|
|
29504
29541
|
return null;
|
|
29505
29542
|
}
|
|
29506
|
-
var centeredX = x - OFFSET;
|
|
29507
|
-
var centeredY = y - OFFSET;
|
|
29543
|
+
var centeredX = x - OFFSET$1;
|
|
29544
|
+
var centeredY = y - OFFSET$1;
|
|
29508
29545
|
var stackInfo = onRenderStackInfo((_item$_id = item == null ? void 0 : item._id) != null ? _item$_id : '', (_item$stackQty = item == null ? void 0 : item.stackQty) != null ? _item$stackQty : 0);
|
|
29509
29546
|
return React__default.createElement(Container$e, null, React__default.createElement(SpriteContainer, {
|
|
29510
29547
|
x: centeredX,
|