@rpg-engine/long-bow 0.5.24 → 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";
@@ -1,6 +1,6 @@
1
- declare type CursorPosition = {
2
- x: number;
3
- y: number;
4
- };
5
- export declare const useCursorPosition: () => CursorPosition;
1
+ import { IPosition } from '../types/eventTypes';
2
+ interface ICursorPositionProps {
3
+ scale?: number;
4
+ }
5
+ export declare const useCursorPosition: ({ scale }: ICursorPositionProps) => IPosition;
6
6
  export {};
@@ -14757,7 +14757,9 @@ var Details = /*#__PURE__*/styled.p.withConfig({
14757
14757
  componentId: "sc-kaa0h9-0"
14758
14758
  })(["font-size:", " !important;"], uiFonts.size.xsmall);
14759
14759
 
14760
- 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;
14761
14763
  var _useState = React.useState({
14762
14764
  x: 0,
14763
14765
  y: 0
@@ -14765,26 +14767,32 @@ var useCursorPosition = function useCursorPosition() {
14765
14767
  position = _useState[0],
14766
14768
  setPosition = _useState[1];
14767
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;
14768
14773
  if ('touches' in e) {
14769
- setPosition({
14770
- x: e.touches[0].clientX,
14771
- y: e.touches[0].clientY
14772
- });
14774
+ x = e.touches[0].clientX;
14775
+ y = e.touches[0].clientY;
14773
14776
  } else {
14774
- setPosition({
14775
- x: e.clientX,
14776
- y: e.clientY
14777
- });
14777
+ x = e.clientX;
14778
+ y = e.clientY;
14778
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
14785
+ });
14779
14786
  };
14780
14787
  React.useEffect(function () {
14781
14788
  window.addEventListener('mousemove', setFromEvent);
14782
14789
  window.addEventListener('touchmove', setFromEvent);
14790
+ console.log("SCALE IS ", scale);
14783
14791
  return function () {
14784
14792
  window.removeEventListener('mousemove', setFromEvent);
14785
14793
  window.removeEventListener('touchmove', setFromEvent);
14786
14794
  };
14787
- }, []);
14795
+ }, [scale]);
14788
14796
  return position;
14789
14797
  };
14790
14798
 
@@ -14793,10 +14801,13 @@ var OFFSET = CONTAINER_SIZE / 2;
14793
14801
  var DraggedItem = function DraggedItem(_ref) {
14794
14802
  var _item$_id, _item$stackQty;
14795
14803
  var atlasJSON = _ref.atlasJSON,
14796
- atlasIMG = _ref.atlasIMG;
14804
+ atlasIMG = _ref.atlasIMG,
14805
+ scale = _ref.scale;
14797
14806
  var _useDragging = useDragging(),
14798
14807
  item = _useDragging.item;
14799
- var _useCursorPosition = useCursorPosition(),
14808
+ var _useCursorPosition = useCursorPosition({
14809
+ scale: scale
14810
+ }),
14800
14811
  x = _useCursorPosition.x,
14801
14812
  y = _useCursorPosition.y;
14802
14813
  if (!item) {
@@ -14917,7 +14928,8 @@ var EquipmentSet = function EquipmentSet(_ref) {
14917
14928
  };
14918
14929
  return React__default.createElement(DraggingProvider, null, React__default.createElement(DraggedItem, {
14919
14930
  atlasIMG: atlasIMG,
14920
- atlasJSON: atlasJSON
14931
+ atlasJSON: atlasJSON,
14932
+ scale: scale
14921
14933
  }), React__default.createElement(DraggableContainer, {
14922
14934
  title: 'Equipments',
14923
14935
  type: exports.RPGUIContainerTypes.Framed,
@@ -15994,7 +16006,8 @@ var ItemContainer$1 = function ItemContainer(_ref) {
15994
16006
  };
15995
16007
  return React__default.createElement(DraggingProvider, null, React__default.createElement(DraggedItem, {
15996
16008
  atlasIMG: atlasIMG,
15997
- atlasJSON: atlasJSON
16009
+ atlasJSON: atlasJSON,
16010
+ scale: scale
15998
16011
  }), React__default.createElement(SlotsContainer, {
15999
16012
  title: itemContainer.name || 'Container',
16000
16013
  onClose: onClose,