@rpg-engine/long-bow 0.8.36 → 0.8.37

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.8.36",
3
+ "version": "0.8.37",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -8,10 +8,6 @@ import {
8
8
  IVideoGuide,
9
9
  isMobileOrTablet,
10
10
  } from '@rpg-engine/shared';
11
- import {
12
- UI_BREAKPOINT_MOBILE,
13
- UI_BREAKPOINT_SMALL_LAPTOP,
14
- } from '../../constants/uiBreakpoints';
15
11
  import { DraggableContainer } from '../DraggableContainer';
16
12
  import { InternalTabs } from '../InternalTabs/InternalTabs';
17
13
  import { RPGUIContainerTypes } from '../RPGUI/RPGUIContainer';
@@ -147,15 +143,6 @@ const Container = styled.div`
147
143
  @media (min-width: 480px) {
148
144
  padding: 0.75rem;
149
145
  }
150
-
151
- @media (min-width: ${UI_BREAKPOINT_MOBILE}) {
152
- max-width: 900px;
153
- padding: 1rem;
154
- }
155
-
156
- @media (min-width: ${UI_BREAKPOINT_SMALL_LAPTOP}) {
157
- max-width: 1200px;
158
- }
159
146
  `;
160
147
 
161
148
  const LoadingMessage = styled.div`
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { UI_BREAKPOINT_MOBILE } from '../../constants/uiBreakpoints';
4
4
  import { SpriteFromAtlas } from '../shared/SpriteFromAtlas';
@@ -26,13 +26,46 @@ export const InformationCenterCell: React.FC<IInformationCenterCellProps> = ({
26
26
  onMouseMove,
27
27
  onTouchStart,
28
28
  }) => {
29
+ const [touchStartY, setTouchStartY] = useState<number | null>(null);
30
+ const [touchStartX, setTouchStartX] = useState<number | null>(null);
31
+ const [isTouchScrolling, setIsTouchScrolling] = useState(false);
32
+
33
+ const handleTouchStart = (e: React.TouchEvent) => {
34
+ setTouchStartY(e.touches[0].clientY);
35
+ setTouchStartX(e.touches[0].clientX);
36
+ setIsTouchScrolling(false);
37
+ };
38
+
39
+ const handleTouchMove = (e: React.TouchEvent) => {
40
+ if (touchStartY !== null && touchStartX !== null) {
41
+ const touchDiffY = Math.abs(e.touches[0].clientY - touchStartY);
42
+ const touchDiffX = Math.abs(e.touches[0].clientX - touchStartX);
43
+
44
+ // If user moved finger more than 15px in any direction, consider it scrolling
45
+ if (touchDiffY > 15 || touchDiffX > 15) {
46
+ setIsTouchScrolling(true);
47
+ e.stopPropagation(); // Prevent parent elements from handling this touch
48
+ }
49
+ }
50
+ };
51
+
52
+ const handleTouchEnd = (e: React.TouchEvent) => {
53
+ if (!isTouchScrolling && onTouchStart) {
54
+ onTouchStart(e);
55
+ }
56
+ setTouchStartY(null);
57
+ setTouchStartX(null);
58
+ };
59
+
29
60
  return (
30
61
  <CellContainer
31
62
  onClick={onClick}
32
63
  onMouseEnter={onMouseEnter}
33
64
  onMouseLeave={onMouseLeave}
34
65
  onMouseMove={onMouseMove}
35
- onTouchStart={onTouchStart}
66
+ onTouchStart={handleTouchStart}
67
+ onTouchMove={handleTouchMove}
68
+ onTouchEnd={handleTouchEnd}
36
69
  >
37
70
  <SpriteContainer>
38
71
  <SpriteFromAtlas
@@ -54,30 +87,31 @@ export const InformationCenterCell: React.FC<IInformationCenterCellProps> = ({
54
87
  const CellContainer = styled.div`
55
88
  position: relative;
56
89
  background: rgba(0, 0, 0, 0.2);
57
- padding: 0.25rem;
90
+ padding: 0.2rem;
58
91
  border-radius: 4px;
59
92
  display: flex;
60
93
  flex-direction: column;
61
94
  align-items: center;
62
- justify-content: flex-start;
95
+ justify-content: center;
63
96
  cursor: pointer;
64
97
  transition: background-color 0.2s ease;
65
98
  width: 100%;
66
99
  height: 100%;
67
- min-height: 135px;
100
+ min-height: 90px;
68
101
  box-sizing: border-box;
69
- gap: 0.25rem;
102
+ gap: 0.2rem;
70
103
  margin: 0;
71
104
 
72
105
  @media (min-width: 360px) {
73
- padding: 0.75rem;
74
- gap: 0.75rem;
75
- margin: 2px;
76
- width: calc(100% - 4px);
106
+ padding: 0.3rem;
107
+ gap: 0.3rem;
108
+ margin: 1px;
109
+ width: calc(100% - 2px);
110
+ min-height: 100px;
77
111
  }
78
112
 
79
113
  @media (min-width: ${UI_BREAKPOINT_MOBILE}) {
80
- min-height: 150px;
114
+ min-height: 110px;
81
115
  }
82
116
 
83
117
  &:hover {
@@ -86,30 +120,33 @@ const CellContainer = styled.div`
86
120
  `;
87
121
 
88
122
  const SpriteContainer = styled.div`
89
- margin-bottom: 0;
90
123
  display: flex;
91
124
  justify-content: center;
92
125
  align-items: center;
93
- width: 40px;
94
- height: 40px;
126
+ width: 32px;
127
+ height: 32px;
95
128
  position: relative;
96
129
  background: rgba(0, 0, 0, 0.3);
97
130
  border-radius: 4px;
98
131
  flex-shrink: 0;
132
+ overflow: hidden;
133
+
134
+ padding: 1rem;
135
+ margin-top: 1rem;
99
136
 
100
137
  @media (min-width: 360px) {
101
- width: 48px;
102
- height: 48px;
138
+ width: 36px;
139
+ height: 36px;
103
140
  }
104
141
 
105
142
  @media (min-width: 480px) {
106
- width: 64px;
107
- height: 64px;
143
+ width: 42px;
144
+ height: 42px;
108
145
  }
109
146
 
110
147
  @media (min-width: ${UI_BREAKPOINT_MOBILE}) {
111
- width: 72px;
112
- height: 72px;
148
+ width: 48px;
149
+ height: 48px;
113
150
  }
114
151
 
115
152
  .sprite-from-atlas-img {
@@ -125,19 +162,19 @@ const CellNameContainer = styled.div`
125
162
  display: flex;
126
163
  flex-direction: column;
127
164
  align-items: center;
128
- justify-content: flex-start;
165
+ justify-content: center;
129
166
  flex: 1;
130
167
  width: 100%;
131
- padding-top: 0.25rem;
168
+ padding-top: 0.1rem;
132
169
  `;
133
170
 
134
171
  const CellName = styled.h3`
135
- font-size: 0.55rem;
172
+ font-size: 0.5rem;
136
173
  color: #fef08a;
137
174
  margin: 0;
138
175
  text-align: center;
139
176
  font-family: 'Press Start 2P', cursive;
140
- line-height: 1.2;
177
+ line-height: 1.1;
141
178
  word-break: break-word;
142
179
  max-width: 100%;
143
180
  overflow-wrap: break-word;
@@ -151,14 +188,14 @@ const CellName = styled.h3`
151
188
  }
152
189
 
153
190
  @media (min-width: 360px) {
154
- font-size: 0.6rem;
191
+ font-size: 0.55rem;
155
192
  }
156
193
 
157
194
  @media (min-width: 480px) {
158
- font-size: 0.7rem;
195
+ font-size: 0.6rem;
159
196
  }
160
197
 
161
198
  @media (min-width: ${UI_BREAKPOINT_MOBILE}) {
162
- font-size: 0.8rem;
199
+ font-size: 0.65rem;
163
200
  }
164
201
  `;
@@ -113,9 +113,9 @@ export const AdvancedFilters: React.FC<IAdvancedFiltersProps> = ({
113
113
  const isMobileView = window.innerWidth < 480;
114
114
 
115
115
  if (isMobileView) {
116
- // Center in the screen for mobile
116
+ // For mobile, position in center of screen
117
117
  setButtonPosition({
118
- top: Math.max(50, window.innerHeight / 2 - 150),
118
+ top: window.innerHeight / 2,
119
119
  left: window.innerWidth / 2,
120
120
  isMobile: true,
121
121
  });
@@ -189,18 +189,20 @@ export const AdvancedFilters: React.FC<IAdvancedFiltersProps> = ({
189
189
  ref={panelRef}
190
190
  style={{
191
191
  position: 'fixed',
192
- top: `${buttonPosition.top}px`,
193
- left: `${buttonPosition.left}px`,
194
- transform: 'translateX(-50%)',
192
+ top: buttonPosition.isMobile ? '50vh' : `${buttonPosition.top}px`,
193
+ left: buttonPosition.isMobile
194
+ ? '50vw'
195
+ : `${buttonPosition.left}px`,
196
+ transform: buttonPosition.isMobile
197
+ ? 'translate(-50%, -50%)'
198
+ : 'translateX(-50%)',
195
199
  zIndex: 9999,
196
200
  }}
197
201
  $isMobile={buttonPosition.isMobile}
198
202
  >
199
203
  <FilterHeader>
200
204
  <FilterTitle>Advanced Filters</FilterTitle>
201
- {buttonPosition.isMobile && (
202
- <CloseButton onClick={onToggle}>×</CloseButton>
203
- )}
205
+ <CloseButton onClick={onToggle}>×</CloseButton>
204
206
  </FilterHeader>
205
207
 
206
208
  {sections.map(renderFilterSection)}
@@ -113,10 +113,15 @@ const Content = styled.div<{
113
113
  flex: 1;
114
114
  padding: 0.25rem;
115
115
  min-height: 200px;
116
- max-height: ${props => props.$maxHeight};
117
- overflow-y: ${props => (props.$maxHeight ? 'auto' : 'visible')};
116
+ max-height: 60vh;
117
+ height: 100%;
118
+ overflow-y: auto;
119
+ overflow-x: hidden;
118
120
  box-sizing: border-box;
119
121
 
122
+ scrollbar-width: thin;
123
+ scrollbar-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.2);
124
+
120
125
  @media (min-width: 360px) {
121
126
  padding: 0.5rem;
122
127
  }
@@ -132,37 +137,36 @@ const Content = styled.div<{
132
137
  align-items: start;
133
138
  justify-content: center;
134
139
  width: 100%;
135
- overflow-x: hidden;
136
140
 
137
141
  @media (min-width: 320px) {
138
- grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
142
+ grid-template-columns: repeat(2, minmax(100px, 1fr));
139
143
  }
140
144
 
141
145
  @media (min-width: 400px) {
142
- grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
146
+ grid-template-columns: repeat(2, minmax(120px, 1fr));
143
147
  gap: 0.75rem;
144
148
  }
145
149
 
146
150
  @media (min-width: 480px) {
147
- grid-template-columns: repeat(2, minmax(135px, 1fr));
151
+ grid-template-columns: repeat(3, minmax(120px, 1fr));
148
152
  gap: 1rem;
149
153
  }
150
154
 
151
155
  @media (min-width: 768px) {
152
- grid-template-columns: repeat(3, minmax(135px, 1fr));
156
+ grid-template-columns: repeat(4, minmax(120px, 1fr));
153
157
  }
154
158
 
155
159
  @media (min-width: ${UI_BREAKPOINT_MOBILE}) {
156
160
  grid-template-columns: repeat(
157
161
  ${props => Math.min(props.$gridColumns, 4)},
158
- minmax(135px, 1fr)
162
+ minmax(120px, 1fr)
159
163
  );
160
164
  }
161
165
 
162
166
  @media (min-width: ${UI_BREAKPOINT_SMALL_LAPTOP}) {
163
167
  grid-template-columns: repeat(
164
168
  ${props => props.$gridColumns},
165
- minmax(135px, 1fr)
169
+ minmax(120px, 1fr)
166
170
  );
167
171
  }
168
172
 
@@ -173,7 +177,7 @@ const Content = styled.div<{
173
177
  height: ${props => props.$itemHeight ?? 'auto'};
174
178
  width: 100%;
175
179
  box-sizing: border-box;
176
- min-height: 135px;
180
+ min-height: 120px;
177
181
  }
178
182
  }
179
183