@rpg-engine/long-bow 0.8.16 → 0.8.17
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 +43 -6
- 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 +43 -6
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CraftBook/CraftingTooltip.tsx +45 -14
package/dist/long-bow.esm.js
CHANGED
|
@@ -28670,10 +28670,11 @@ var modifyString = function modifyString(str) {
|
|
|
28670
28670
|
return modifiedWords.join(' ');
|
|
28671
28671
|
};
|
|
28672
28672
|
|
|
28673
|
+
var OFFSET = 20;
|
|
28673
28674
|
var TooltipContainer = /*#__PURE__*/styled.div.withConfig({
|
|
28674
28675
|
displayName: "CraftingTooltip__TooltipContainer",
|
|
28675
28676
|
componentId: "sc-iqzgok-0"
|
|
28676
|
-
})(["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
|
|
28677
|
+
})(["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) {
|
|
28677
28678
|
return props.x;
|
|
28678
28679
|
}, function (props) {
|
|
28679
28680
|
return props.y;
|
|
@@ -28709,11 +28710,47 @@ var CraftingTooltip = function CraftingTooltip(_ref3) {
|
|
|
28709
28710
|
skills = _ref3.skills,
|
|
28710
28711
|
atlasIMG = _ref3.atlasIMG,
|
|
28711
28712
|
atlasJSON = _ref3.atlasJSON;
|
|
28713
|
+
var tooltipRef = useRef(null);
|
|
28714
|
+
var _React$useState = React.useState({
|
|
28715
|
+
x: x,
|
|
28716
|
+
y: y
|
|
28717
|
+
}),
|
|
28718
|
+
adjustedPosition = _React$useState[0],
|
|
28719
|
+
setAdjustedPosition = _React$useState[1];
|
|
28720
|
+
useEffect(function () {
|
|
28721
|
+
var tooltipElement = tooltipRef.current;
|
|
28722
|
+
if (tooltipElement) {
|
|
28723
|
+
var rect = tooltipElement.getBoundingClientRect();
|
|
28724
|
+
var tooltipWidth = rect.width;
|
|
28725
|
+
var tooltipHeight = rect.height;
|
|
28726
|
+
var adjustedX = x;
|
|
28727
|
+
var adjustedY = y;
|
|
28728
|
+
// If tooltip would go off the right edge, show it on the left side of the cursor
|
|
28729
|
+
if (x + tooltipWidth + OFFSET > window.innerWidth) {
|
|
28730
|
+
adjustedX = x - tooltipWidth - OFFSET;
|
|
28731
|
+
} else {
|
|
28732
|
+
// Otherwise, show it on the right side of the cursor
|
|
28733
|
+
adjustedX = x + OFFSET;
|
|
28734
|
+
}
|
|
28735
|
+
// Vertical positioning
|
|
28736
|
+
if (y + tooltipHeight > window.innerHeight) {
|
|
28737
|
+
adjustedY = window.innerHeight - tooltipHeight - OFFSET;
|
|
28738
|
+
}
|
|
28739
|
+
if (y < OFFSET) {
|
|
28740
|
+
adjustedY = OFFSET;
|
|
28741
|
+
}
|
|
28742
|
+
setAdjustedPosition({
|
|
28743
|
+
x: adjustedX,
|
|
28744
|
+
y: adjustedY
|
|
28745
|
+
});
|
|
28746
|
+
}
|
|
28747
|
+
}, [x, y]);
|
|
28712
28748
|
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;
|
|
28713
28749
|
var levelIsOk = (_recipe$levelIsOk = recipe == null ? void 0 : recipe.levelIsOk) != null ? _recipe$levelIsOk : false;
|
|
28714
28750
|
return React.createElement(TooltipContainer, {
|
|
28715
|
-
|
|
28716
|
-
|
|
28751
|
+
ref: tooltipRef,
|
|
28752
|
+
x: adjustedPosition.x,
|
|
28753
|
+
y: adjustedPosition.y
|
|
28717
28754
|
}, React.createElement(TooltipTitle, null, "Skill Requirements"), React.createElement(MinCraftingRequirementsText, {
|
|
28718
28755
|
levelIsOk: levelIsOk
|
|
28719
28756
|
}, 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.createElement(TooltipTitle, null, "Ingredients"), recipe.ingredients.map(function (ingredient, index) {
|
|
@@ -29476,7 +29513,7 @@ var useCursorPosition = function useCursorPosition(_ref) {
|
|
|
29476
29513
|
};
|
|
29477
29514
|
|
|
29478
29515
|
var CONTAINER_SIZE = 32;
|
|
29479
|
-
var OFFSET = CONTAINER_SIZE / 2;
|
|
29516
|
+
var OFFSET$1 = CONTAINER_SIZE / 2;
|
|
29480
29517
|
var DraggedItem = function DraggedItem(_ref) {
|
|
29481
29518
|
var _item$_id, _item$stackQty;
|
|
29482
29519
|
var atlasJSON = _ref.atlasJSON,
|
|
@@ -29496,8 +29533,8 @@ var DraggedItem = function DraggedItem(_ref) {
|
|
|
29496
29533
|
if (x === 0 && y === 0) {
|
|
29497
29534
|
return null;
|
|
29498
29535
|
}
|
|
29499
|
-
var centeredX = x - OFFSET;
|
|
29500
|
-
var centeredY = y - OFFSET;
|
|
29536
|
+
var centeredX = x - OFFSET$1;
|
|
29537
|
+
var centeredY = y - OFFSET$1;
|
|
29501
29538
|
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);
|
|
29502
29539
|
return React.createElement(Container$e, null, React.createElement(SpriteContainer, {
|
|
29503
29540
|
x: centeredX,
|