@rpg-engine/long-bow 0.2.95 → 0.2.97

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.2.95",
3
+ "version": "0.2.97",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -83,7 +83,7 @@
83
83
  },
84
84
  "dependencies": {
85
85
  "@rollup/plugin-image": "^2.1.1",
86
- "@rpg-engine/shared": "^0.6.40",
86
+ "@rpg-engine/shared": "^0.6.49",
87
87
  "dayjs": "^1.11.2",
88
88
  "fs-extra": "^10.1.0",
89
89
  "is-mobile": "^3.1.1",
@@ -123,7 +123,7 @@ const CloseButton = styled.div`
123
123
  right: 0px;
124
124
  color: white;
125
125
  z-index: 22;
126
- font-size: 0.8rem;
126
+ font-size: 1.1rem;
127
127
  `;
128
128
 
129
129
  const TitleContainer = styled.div`
@@ -34,6 +34,7 @@ export interface IEquipmentSetProps {
34
34
  ) => void;
35
35
  onItemOutsideDrop?: (item: IItem, position: IPosition) => void;
36
36
  checkIfItemCanBeMoved: () => boolean;
37
+ checkIfItemShouldDragEnd?: () => boolean;
37
38
  onMouseOver?: (e: any, slotIndex: number, item: IItem | null) => void;
38
39
  onSelected?: (optionId: string) => void;
39
40
  initialPosition?: { x: number; y: number };
@@ -55,6 +56,7 @@ export const EquipmentSet: React.FC<IEquipmentSetProps> = ({
55
56
  onItemPlaceDrop,
56
57
  onItemOutsideDrop,
57
58
  checkIfItemCanBeMoved,
59
+ checkIfItemShouldDragEnd,
58
60
  }) => {
59
61
  const {
60
62
  neck,
@@ -133,6 +135,7 @@ export const EquipmentSet: React.FC<IEquipmentSetProps> = ({
133
135
  if (onItemDragEnd) onItemDragEnd(quantity);
134
136
  }}
135
137
  checkIfItemCanBeMoved={checkIfItemCanBeMoved}
138
+ checkIfItemShouldDragEnd={checkIfItemShouldDragEnd}
136
139
  onPlaceDrop={(item, slotIndex, itemContainerType) => {
137
140
  if (onItemPlaceDrop)
138
141
  onItemPlaceDrop(item, slotIndex, itemContainerType);
@@ -28,6 +28,7 @@ export interface IItemContainerProps {
28
28
  itemContainerType: ItemContainerType | null
29
29
  ) => void;
30
30
  checkIfItemCanBeMoved: () => boolean;
31
+ checkIfItemShouldDragEnd?: () => boolean;
31
32
  onMouseOver?: (e: any, slotIndex: number, item: IItem | null) => void;
32
33
  onSelected?: (optionId: string, item: IItem) => void;
33
34
  type: ItemContainerType;
@@ -53,6 +54,7 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
53
54
  onOutsideDrop,
54
55
  checkIfItemCanBeMoved,
55
56
  initialPosition,
57
+ checkIfItemShouldDragEnd,
56
58
  }) => {
57
59
  const [quantitySelect, setQuantitySelect] = useState({
58
60
  isOpen: false,
@@ -88,6 +90,7 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
88
90
  if (onItemDragEnd) onItemDragEnd(quantity);
89
91
  }}
90
92
  checkIfItemCanBeMoved={checkIfItemCanBeMoved}
93
+ checkIfItemShouldDragEnd={checkIfItemShouldDragEnd}
91
94
  openQuantitySelector={(maxQuantity, callback) => {
92
95
  setQuantitySelect({
93
96
  isOpen: true,
@@ -62,6 +62,7 @@ interface IProps {
62
62
  onDragEnd: (quantity?: number) => void;
63
63
  onOutsideDrop?: (item: IItem, position: IPosition) => void;
64
64
  checkIfItemCanBeMoved: () => boolean;
65
+ checkIfItemShouldDragEnd?: () => boolean;
65
66
  openQuantitySelector?: (maxQuantity: number, callback: () => void) => void;
66
67
  onPlaceDrop: (
67
68
  item: IItem | null,
@@ -92,6 +93,7 @@ export const ItemSlot: React.FC<IProps> = observer(
92
93
  onOutsideDrop: onDrop,
93
94
  checkIfItemCanBeMoved,
94
95
  openQuantitySelector,
96
+ checkIfItemShouldDragEnd,
95
97
  }) => {
96
98
  const [isTooltipVisible, setTooltipVisible] = useState(false);
97
99
 
@@ -109,6 +111,7 @@ export const ItemSlot: React.FC<IProps> = observer(
109
111
 
110
112
  useEffect(() => {
111
113
  setDragPosition({ x: 0, y: 0 });
114
+ setIsFocused(false);
112
115
 
113
116
  if (item) {
114
117
  setContextActions(generateContextMenu(item, containerType));
@@ -238,7 +241,6 @@ export const ItemSlot: React.FC<IProps> = observer(
238
241
 
239
242
  const resetItem = () => {
240
243
  setTooltipVisible(false);
241
- setIsFocused(false);
242
244
  setWasDragged(false);
243
245
  };
244
246
 
@@ -305,6 +307,9 @@ export const ItemSlot: React.FC<IProps> = observer(
305
307
 
306
308
  setTimeout(() => {
307
309
  if (checkIfItemCanBeMoved()) {
310
+ if (checkIfItemShouldDragEnd && !checkIfItemShouldDragEnd())
311
+ return;
312
+
308
313
  if (
309
314
  item.stackQty &&
310
315
  item.stackQty !== 1 &&
@@ -314,6 +319,7 @@ export const ItemSlot: React.FC<IProps> = observer(
314
319
  else onSuccesfulDrag(item.stackQty);
315
320
  } else {
316
321
  resetItem();
322
+ setIsFocused(false);
317
323
  setDragPosition({ x: 0, y: 0 });
318
324
  }
319
325
  }, 100);
@@ -360,7 +366,9 @@ export const ItemSlot: React.FC<IProps> = observer(
360
366
  </ItemContainer>
361
367
  </Draggable>
362
368
 
363
- {isTooltipVisible && item && <ItemTooltip label={item.name} />}
369
+ {isTooltipVisible && item && !isFocused && (
370
+ <ItemTooltip label={item.name} />
371
+ )}
364
372
 
365
373
  {!isContextMenuDisabled && isContextMenuVisible && contextActions && (
366
374
  <RelativeListMenu
@@ -67,7 +67,6 @@ export const SkillsContainer: React.FC<ISkillContainerProps> = ({
67
67
  for (const [key, value] of Object.entries(skillCategory.values)) {
68
68
  //@ts-ignore
69
69
  const skillDetails = (skill[key] as unknown) as ISkillDetails;
70
-
71
70
 
72
71
  output.push(
73
72
  <SkillProgressBar
@@ -164,5 +163,5 @@ const CloseButton = styled.div`
164
163
  right: 2px;
165
164
  color: white;
166
165
  z-index: 22;
167
- font-size: 0.7rem;
166
+ font-size: 1.1rem;
168
167
  `;
@@ -81,8 +81,9 @@ const Template: Story<IItemContainerProps> = () => {
81
81
  newContainer.slots[dropSlot] = dragItem;
82
82
  newContainer.slots[dragSlot] = null;
83
83
  }
84
-
85
- setItemContainer(newContainer);
84
+ setTimeout(() => {
85
+ setItemContainer(newContainer);
86
+ }, 100);
86
87
  }
87
88
 
88
89
  allowedToDrop = false;
package/src/.DS_Store DELETED
Binary file
Binary file
Binary file
Binary file