@rpg-engine/long-bow 0.5.23 → 0.5.24

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.
@@ -0,0 +1,6 @@
1
+ declare type CursorPosition = {
2
+ x: number;
3
+ y: number;
4
+ };
5
+ export declare const useCursorPosition: () => CursorPosition;
6
+ export {};
@@ -0,0 +1,12 @@
1
+ import { IItem, IShortcut } from '@rpg-engine/shared';
2
+ interface IUseShortcuts {
3
+ itemContainer: {
4
+ slots: Record<number, IItem | null | undefined>;
5
+ };
6
+ }
7
+ export declare const useShortcuts: ({ itemContainer }: IUseShortcuts) => {
8
+ shortcuts: IShortcut[];
9
+ setItemShortcut: (key: string, index: number) => void;
10
+ removeShortcut: (index: number) => void;
11
+ };
12
+ export {};
@@ -13479,6 +13479,8 @@ var ItemSlotRenderer = function ItemSlotRenderer(_ref) {
13479
13479
  return renderEquipment(itemToRender);
13480
13480
  case shared.ItemContainerType.Inventory:
13481
13481
  return renderItem(itemToRender);
13482
+ case shared.ItemContainerType.Depot:
13483
+ return renderItem(itemToRender);
13482
13484
  default:
13483
13485
  return null;
13484
13486
  }
@@ -14760,44 +14762,30 @@ var useCursorPosition = function useCursorPosition() {
14760
14762
  x: 0,
14761
14763
  y: 0
14762
14764
  }),
14763
- cursorPosition = _useState[0],
14764
- setCursorPosition = _useState[1];
14765
- React.useEffect(function () {
14766
- var animationFrameId;
14767
- var updateCursorPosition = function updateCursorPosition(x, y) {
14768
- // Cancel the previous frame request
14769
- cancelAnimationFrame(animationFrameId);
14770
- // Request a new frame
14771
- animationFrameId = requestAnimationFrame(function () {
14772
- setCursorPosition({
14773
- x: x,
14774
- y: y
14775
- });
14765
+ position = _useState[0],
14766
+ setPosition = _useState[1];
14767
+ var setFromEvent = function setFromEvent(e) {
14768
+ if ('touches' in e) {
14769
+ setPosition({
14770
+ x: e.touches[0].clientX,
14771
+ y: e.touches[0].clientY
14776
14772
  });
14777
- };
14778
- var handleMouseMove = function handleMouseMove(event) {
14779
- updateCursorPosition(event.clientX, event.clientY);
14780
- };
14781
- var handleTouchMove = function handleTouchMove(event) {
14782
- // Prevent default touch behavior (like scrolling)
14783
- event.preventDefault();
14784
- if (event.touches.length > 0) {
14785
- var touch = event.touches[0];
14786
- updateCursorPosition(touch.clientX, touch.clientY);
14787
- }
14788
- };
14789
- window.addEventListener('mousemove', handleMouseMove);
14790
- window.addEventListener('touchmove', handleTouchMove, {
14791
- passive: false
14792
- });
14793
- // Cleanup function
14773
+ } else {
14774
+ setPosition({
14775
+ x: e.clientX,
14776
+ y: e.clientY
14777
+ });
14778
+ }
14779
+ };
14780
+ React.useEffect(function () {
14781
+ window.addEventListener('mousemove', setFromEvent);
14782
+ window.addEventListener('touchmove', setFromEvent);
14794
14783
  return function () {
14795
- window.removeEventListener('mousemove', handleMouseMove);
14796
- window.removeEventListener('touchmove', handleTouchMove);
14797
- cancelAnimationFrame(animationFrameId);
14784
+ window.removeEventListener('mousemove', setFromEvent);
14785
+ window.removeEventListener('touchmove', setFromEvent);
14798
14786
  };
14799
14787
  }, []);
14800
- return cursorPosition;
14788
+ return position;
14801
14789
  };
14802
14790
 
14803
14791
  var CONTAINER_SIZE = 32;