@rpg-engine/long-bow 0.5.23 → 0.5.26

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.
@@ -2,6 +2,7 @@
2
2
  interface IProps {
3
3
  atlasJSON: any;
4
4
  atlasIMG: any;
5
+ scale?: number;
5
6
  }
6
- export declare const DraggedItem: ({ atlasJSON, atlasIMG, }: IProps) => JSX.Element | null;
7
+ export declare const DraggedItem: ({ atlasJSON, atlasIMG, scale, }: IProps) => JSX.Element | null;
7
8
  export default DraggedItem;
@@ -0,0 +1,7 @@
1
+ interface IScalableContainerProps {
2
+ scale?: number;
3
+ centralize?: boolean;
4
+ breakPoint?: string;
5
+ }
6
+ export declare const ScalableContainer: import("styled-components").StyledComponent<"div", any, IScalableContainerProps, never>;
7
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const UI_BREAKPOINT_MOBILE = "950px";
2
+ export declare const UI_BREAKPOINT_SMALL_LAPTOP = "1400px";
@@ -0,0 +1,6 @@
1
+ import { IPosition } from '../types/eventTypes';
2
+ interface ICursorPositionProps {
3
+ scale?: number;
4
+ }
5
+ export declare const useCursorPosition: ({ scale }: ICursorPositionProps) => IPosition;
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
  }
@@ -14755,49 +14757,43 @@ var Details = /*#__PURE__*/styled.p.withConfig({
14755
14757
  componentId: "sc-kaa0h9-0"
14756
14758
  })(["font-size:", " !important;"], uiFonts.size.xsmall);
14757
14759
 
14758
- var useCursorPosition = function useCursorPosition() {
14760
+ var useCursorPosition = function useCursorPosition(_ref) {
14761
+ var _ref$scale = _ref.scale,
14762
+ scale = _ref$scale === void 0 ? 1 : _ref$scale;
14759
14763
  var _useState = React.useState({
14760
14764
  x: 0,
14761
14765
  y: 0
14762
14766
  }),
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
- });
14776
- });
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
14767
+ position = _useState[0],
14768
+ setPosition = _useState[1];
14769
+ var setFromEvent = function setFromEvent(e) {
14770
+ var x, y;
14771
+ var viewportCenterX = window.innerWidth / 2 - shared.GRID_WIDTH;
14772
+ var viewportCenterY = window.innerHeight / -shared.GRID_HEIGHT;
14773
+ if ('touches' in e) {
14774
+ x = e.touches[0].clientX;
14775
+ y = e.touches[0].clientY;
14776
+ } else {
14777
+ x = e.clientX;
14778
+ y = e.clientY;
14779
+ }
14780
+ // Adjusting for the global scale
14781
+ // Assuming the element is centrally located
14782
+ setPosition({
14783
+ x: (x - viewportCenterX) / scale + viewportCenterX,
14784
+ y: (y - viewportCenterY) / scale + viewportCenterY
14792
14785
  });
14793
- // Cleanup function
14786
+ };
14787
+ React.useEffect(function () {
14788
+ window.addEventListener('mousemove', setFromEvent);
14789
+ window.addEventListener('touchmove', setFromEvent);
14790
+ console.log("SCALE IS ", scale);
14794
14791
  return function () {
14795
- window.removeEventListener('mousemove', handleMouseMove);
14796
- window.removeEventListener('touchmove', handleTouchMove);
14797
- cancelAnimationFrame(animationFrameId);
14792
+ window.removeEventListener('mousemove', setFromEvent);
14793
+ window.removeEventListener('touchmove', setFromEvent);
14798
14794
  };
14799
- }, []);
14800
- return cursorPosition;
14795
+ }, [scale]);
14796
+ return position;
14801
14797
  };
14802
14798
 
14803
14799
  var CONTAINER_SIZE = 32;
@@ -14805,10 +14801,13 @@ var OFFSET = CONTAINER_SIZE / 2;
14805
14801
  var DraggedItem = function DraggedItem(_ref) {
14806
14802
  var _item$_id, _item$stackQty;
14807
14803
  var atlasJSON = _ref.atlasJSON,
14808
- atlasIMG = _ref.atlasIMG;
14804
+ atlasIMG = _ref.atlasIMG,
14805
+ scale = _ref.scale;
14809
14806
  var _useDragging = useDragging(),
14810
14807
  item = _useDragging.item;
14811
- var _useCursorPosition = useCursorPosition(),
14808
+ var _useCursorPosition = useCursorPosition({
14809
+ scale: scale
14810
+ }),
14812
14811
  x = _useCursorPosition.x,
14813
14812
  y = _useCursorPosition.y;
14814
14813
  if (!item) {
@@ -14929,7 +14928,8 @@ var EquipmentSet = function EquipmentSet(_ref) {
14929
14928
  };
14930
14929
  return React__default.createElement(DraggingProvider, null, React__default.createElement(DraggedItem, {
14931
14930
  atlasIMG: atlasIMG,
14932
- atlasJSON: atlasJSON
14931
+ atlasJSON: atlasJSON,
14932
+ scale: scale
14933
14933
  }), React__default.createElement(DraggableContainer, {
14934
14934
  title: 'Equipments',
14935
14935
  type: exports.RPGUIContainerTypes.Framed,
@@ -16006,7 +16006,8 @@ var ItemContainer$1 = function ItemContainer(_ref) {
16006
16006
  };
16007
16007
  return React__default.createElement(DraggingProvider, null, React__default.createElement(DraggedItem, {
16008
16008
  atlasIMG: atlasIMG,
16009
- atlasJSON: atlasJSON
16009
+ atlasJSON: atlasJSON,
16010
+ scale: scale
16010
16011
  }), React__default.createElement(SlotsContainer, {
16011
16012
  title: itemContainer.name || 'Container',
16012
16013
  onClose: onClose,