@rpg-engine/long-bow 0.1.792 → 0.1.794
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/dist/components/store/UI.store.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +36 -3
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +36 -3
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Equipment/EquipmentSet.tsx +3 -3
- package/src/components/store/UI.store.ts +32 -5
package/package.json
CHANGED
|
@@ -130,7 +130,7 @@ export const EquipmentSet: React.FC<IEquipmentSetProps> = observer(
|
|
|
130
130
|
cancelDrag=".equipment-container-body"
|
|
131
131
|
onPositionChange={({ x, y }) => {
|
|
132
132
|
setDraggablePosition({ x, y });
|
|
133
|
-
|
|
133
|
+
console.log(draggablePosition)
|
|
134
134
|
}}
|
|
135
135
|
onOutsideClick={() => {
|
|
136
136
|
uiStore.clearContextMenu();
|
|
@@ -145,8 +145,8 @@ export const EquipmentSet: React.FC<IEquipmentSetProps> = observer(
|
|
|
145
145
|
|
|
146
146
|
{uiStore.contextMenu?.visible ? (
|
|
147
147
|
<ListMenu
|
|
148
|
-
x={uiStore.contextMenu.posX - draggablePosition.x}
|
|
149
|
-
y={uiStore.contextMenu.posY - draggablePosition.y}
|
|
148
|
+
x={uiStore.contextMenu.posX - uiStore.draggablePosition.x}
|
|
149
|
+
y={uiStore.contextMenu.posY - uiStore.draggablePosition.y}
|
|
150
150
|
options={uiStore.contextMenu.contextActions}
|
|
151
151
|
onSelected={onSelected}
|
|
152
152
|
/>
|
|
@@ -122,6 +122,9 @@ class UIStore {
|
|
|
122
122
|
this.clearItemHoverDetail();
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
|
+
|
|
126
|
+
this.setDraggablePosition(this.getOffsets())
|
|
127
|
+
|
|
125
128
|
switch (slotContainerType) {
|
|
126
129
|
case SlotContainerType.EQUIPMENT_SET:
|
|
127
130
|
this.setEquipContextMenu(
|
|
@@ -170,10 +173,11 @@ class UIStore {
|
|
|
170
173
|
onMouseOver: any
|
|
171
174
|
): void => {
|
|
172
175
|
if (item) {
|
|
176
|
+
this.setDraggablePosition(this.getOffsets())
|
|
173
177
|
this.setItemHoverDetail({
|
|
174
178
|
visible: true,
|
|
175
|
-
posX,
|
|
176
|
-
posY,
|
|
179
|
+
posX: posX,
|
|
180
|
+
posY: posY,
|
|
177
181
|
item: item,
|
|
178
182
|
});
|
|
179
183
|
}
|
|
@@ -196,9 +200,32 @@ class UIStore {
|
|
|
196
200
|
this.clearContextMenu!();
|
|
197
201
|
}
|
|
198
202
|
|
|
199
|
-
public setDraggablePosition(currentPosition: IPosition){
|
|
200
|
-
|
|
201
|
-
}
|
|
203
|
+
public setDraggablePosition(currentPosition: IPosition){
|
|
204
|
+
this.draggablePosition = { ...currentPosition }
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
private getOffsets = () => {
|
|
208
|
+
const p = { x: 0, y: 0};
|
|
209
|
+
// const body = document.getElementsByTagName('body')
|
|
210
|
+
let body = document.querySelector('body') as any | null;
|
|
211
|
+
|
|
212
|
+
if( body != null){
|
|
213
|
+
p.x = body.offsetLeft;
|
|
214
|
+
p.y = body.offsetTop;
|
|
215
|
+
while(body!.offsetParent){
|
|
216
|
+
console.log(`offsetParent: ${body!.offsetParent}`)
|
|
217
|
+
p.x = p.x + body!.offsetLeft
|
|
218
|
+
p.y = p.y + body!.offsetTop;
|
|
219
|
+
if (body == document.getElementsByTagName("body")[0]) {
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
body = body!.offsetParent;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return p;
|
|
228
|
+
}
|
|
202
229
|
|
|
203
230
|
}
|
|
204
231
|
|