@rpg-engine/long-bow 0.7.81 → 0.7.83
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/hooks/useTouchTarget.d.ts +5 -0
- package/dist/long-bow.cjs.development.js +38 -9
- 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 +39 -10
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Item/Inventory/ItemSlot.tsx +9 -1
- package/src/components/Marketplace/MarketplaceRows.tsx +16 -0
- package/src/hooks/useTouchTarget.ts +38 -0
|
@@ -27377,6 +27377,23 @@ var Container$8 = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
27377
27377
|
componentId: "sc-dgmp04-0"
|
|
27378
27378
|
})(["position:static !important;"]);
|
|
27379
27379
|
|
|
27380
|
+
function useTouchTarget() {
|
|
27381
|
+
var getTouchTarget = React.useCallback(function (e) {
|
|
27382
|
+
// Check if it's a touch event
|
|
27383
|
+
if ('changedTouches' in e || 'touches' in e) {
|
|
27384
|
+
var _touchEvent$changedTo, _touchEvent$touches;
|
|
27385
|
+
var touchEvent = e;
|
|
27386
|
+
var touch = ((_touchEvent$changedTo = touchEvent.changedTouches) == null ? void 0 : _touchEvent$changedTo[0]) || ((_touchEvent$touches = touchEvent.touches) == null ? void 0 : _touchEvent$touches[0]);
|
|
27387
|
+
if (touch) {
|
|
27388
|
+
return document.elementFromPoint(touch.clientX, touch.clientY);
|
|
27389
|
+
}
|
|
27390
|
+
}
|
|
27391
|
+
// If it's not a touch event or touch is not available, fallback to target
|
|
27392
|
+
return e.target || document.body;
|
|
27393
|
+
}, []);
|
|
27394
|
+
return getTouchTarget;
|
|
27395
|
+
}
|
|
27396
|
+
|
|
27380
27397
|
var rarityColor = function rarityColor(item) {
|
|
27381
27398
|
switch (item == null ? void 0 : item.rarity) {
|
|
27382
27399
|
case shared.ItemRarities.Uncommon:
|
|
@@ -27820,6 +27837,7 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
27820
27837
|
detailsState = _useItemSlotDetails.detailsState,
|
|
27821
27838
|
updateDetailsState = _useItemSlotDetails.updateDetailsState,
|
|
27822
27839
|
setContextActions = _useItemSlotDetails.setContextActions;
|
|
27840
|
+
var getTouchTarget = useTouchTarget();
|
|
27823
27841
|
var isContextMenuVisible = detailsState.isContextMenuVisible,
|
|
27824
27842
|
clearDetailsState = detailsState.clearDetailsState,
|
|
27825
27843
|
clearContextActions = detailsState.clearContextActions;
|
|
@@ -27876,6 +27894,9 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
27876
27894
|
item: null
|
|
27877
27895
|
});
|
|
27878
27896
|
var target = e.target;
|
|
27897
|
+
if (shared.isMobile()) {
|
|
27898
|
+
target = getTouchTarget(e);
|
|
27899
|
+
}
|
|
27879
27900
|
handleShortcutSetter(target);
|
|
27880
27901
|
removeDraggingClass(target);
|
|
27881
27902
|
var shouldHandleDraggedItemResult = shouldHandleDraggedItem();
|
|
@@ -31118,13 +31139,16 @@ var MarketplaceRows = function MarketplaceRows(_ref) {
|
|
|
31118
31139
|
onMarketPlaceItemBuy = _ref.onMarketPlaceItemBuy,
|
|
31119
31140
|
onMarketPlaceItemRemove = _ref.onMarketPlaceItemRemove,
|
|
31120
31141
|
disabled = _ref.disabled;
|
|
31142
|
+
var renderGems = function renderGems(item) {
|
|
31143
|
+
return item.attachedGems && onRenderGems(item);
|
|
31144
|
+
};
|
|
31121
31145
|
return React__default.createElement(MarketplaceWrapper, null, React__default.createElement(ItemIconContainer, null, React__default.createElement(SpriteContainer$1, null, React__default.createElement(ItemInfoWrapper, {
|
|
31122
31146
|
item: item,
|
|
31123
31147
|
atlasIMG: atlasIMG,
|
|
31124
31148
|
atlasJSON: atlasJSON,
|
|
31125
31149
|
equipmentSet: equipmentSet,
|
|
31126
31150
|
scale: scale
|
|
31127
|
-
}, React__default.createElement(RarityContainer, {
|
|
31151
|
+
}, React__default.createElement(GemContainer, null, renderGems(item)), React__default.createElement(RarityContainer, {
|
|
31128
31152
|
item: item
|
|
31129
31153
|
}, React__default.createElement(SpriteFromAtlas, {
|
|
31130
31154
|
atlasIMG: atlasIMG,
|
|
@@ -31135,7 +31159,8 @@ var MarketplaceRows = function MarketplaceRows(_ref) {
|
|
|
31135
31159
|
texturePath: item.texturePath,
|
|
31136
31160
|
isStackable: item.isStackable
|
|
31137
31161
|
}, atlasJSON),
|
|
31138
|
-
imgScale: 2
|
|
31162
|
+
imgScale: 2,
|
|
31163
|
+
imgClassname: "sprite-from-atlas-img--item"
|
|
31139
31164
|
})), React__default.createElement(QuantityContainer, null, item.stackQty && item.stackQty > 1 && "x" + Math.round(item.stackQty * 10) / 10))), React__default.createElement(PriceValue, null, React__default.createElement("p", null, React__default.createElement(Ellipsis, {
|
|
31140
31165
|
maxLines: 1,
|
|
31141
31166
|
maxWidth: "200px",
|
|
@@ -31167,33 +31192,37 @@ var QuantityContainer = /*#__PURE__*/styled__default.p.withConfig({
|
|
|
31167
31192
|
displayName: "MarketplaceRows__QuantityContainer",
|
|
31168
31193
|
componentId: "sc-wmpr1o-1"
|
|
31169
31194
|
})(["position:absolute;display:block;top:15px;left:25px;font-size:", " !important;"], uiFonts.size.xsmall);
|
|
31195
|
+
var GemContainer = /*#__PURE__*/styled__default.p.withConfig({
|
|
31196
|
+
displayName: "MarketplaceRows__GemContainer",
|
|
31197
|
+
componentId: "sc-wmpr1o-2"
|
|
31198
|
+
})(["position:absolute;display:block;top:-5px;left:-10px;font-size:", " !important;"], uiFonts.size.xsmall);
|
|
31170
31199
|
var Flex$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
31171
31200
|
displayName: "MarketplaceRows__Flex",
|
|
31172
|
-
componentId: "sc-wmpr1o-
|
|
31201
|
+
componentId: "sc-wmpr1o-3"
|
|
31173
31202
|
})(["display:flex;gap:24px;"]);
|
|
31174
31203
|
var ItemIconContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
31175
31204
|
displayName: "MarketplaceRows__ItemIconContainer",
|
|
31176
|
-
componentId: "sc-wmpr1o-
|
|
31205
|
+
componentId: "sc-wmpr1o-4"
|
|
31177
31206
|
})(["display:flex;justify-content:flex-start;align-items:center;"]);
|
|
31178
31207
|
var GoldContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
31179
31208
|
displayName: "MarketplaceRows__GoldContainer",
|
|
31180
|
-
componentId: "sc-wmpr1o-
|
|
31209
|
+
componentId: "sc-wmpr1o-5"
|
|
31181
31210
|
})(["position:relative;top:-0.5rem;left:0.5rem;"]);
|
|
31182
31211
|
var SpriteContainer$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
31183
31212
|
displayName: "MarketplaceRows__SpriteContainer",
|
|
31184
|
-
componentId: "sc-wmpr1o-
|
|
31213
|
+
componentId: "sc-wmpr1o-6"
|
|
31185
31214
|
})(["position:relative;left:0.5rem;"]);
|
|
31186
31215
|
var PriceValue = /*#__PURE__*/styled__default.div.withConfig({
|
|
31187
31216
|
displayName: "MarketplaceRows__PriceValue",
|
|
31188
|
-
componentId: "sc-wmpr1o-
|
|
31217
|
+
componentId: "sc-wmpr1o-7"
|
|
31189
31218
|
})(["margin-left:40px;"]);
|
|
31190
31219
|
var ButtonContainer$2 = /*#__PURE__*/styled__default.div.withConfig({
|
|
31191
31220
|
displayName: "MarketplaceRows__ButtonContainer",
|
|
31192
|
-
componentId: "sc-wmpr1o-
|
|
31221
|
+
componentId: "sc-wmpr1o-8"
|
|
31193
31222
|
})(["margin:auto;"]);
|
|
31194
31223
|
var RarityContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
31195
31224
|
displayName: "MarketplaceRows__RarityContainer",
|
|
31196
|
-
componentId: "sc-wmpr1o-
|
|
31225
|
+
componentId: "sc-wmpr1o-9"
|
|
31197
31226
|
})(["border-color:", ";box-shadow:", " inset,", ";width:32px;height:32px;"], function (_ref2) {
|
|
31198
31227
|
var item = _ref2.item;
|
|
31199
31228
|
return rarityColor(item);
|