Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Haxxer committed Dec 19, 2023
1 parent 63a3d9f commit 676c713
Show file tree
Hide file tree
Showing 9 changed files with 324 additions and 299 deletions.
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Item Piles Changelog

## Version 2.8.11

- Tweaked styles of vaults and remove item backgrounds to support transparent images
- Fixed item-based currencies to be excluded from the stackable property (currencies can always stack)
- Fixed drag and dropping from other item piles into vaults not showing a proper item size preview
- Fixed issue where larger items would sometimes be able to be dropped on top of other large items

## Version 2.8.10

- Fixed non-stackable items with more than one quantity being added to item piles would incorrectly remove any extra quantity from the item
Expand Down
2 changes: 1 addition & 1 deletion src/API/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -2090,7 +2090,7 @@ class API {
*
* @returns {Array<object>} An array of objects containing the data about each currency
*/
static getActorCurrencies(target, { getAll = false, secondary = True } = {}) {
static getActorCurrencies(target, { getAll = false, secondary = true } = {}) {
return PileUtilities.getActorCurrencies(target, { getAll, secondary });
}

Expand Down
4 changes: 2 additions & 2 deletions src/applications/components/Grid/GridItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@
dispatch("itemstopdrag", {
item,
outOfBounds: !active,
x: pageX - pointerOffset.internalLeft,
y: pageY - pointerOffset.internalTop,
x: pageX,
y: pageY,
gridX: finalTransform.x,
gridY: finalTransform.y,
splitting
Expand Down
4 changes: 3 additions & 1 deletion src/applications/item-editor/item-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import { getActiveApps } from '../../helpers/helpers';
export default class ItemEditor extends SvelteApplication {

constructor(item = false, options) {
let title = game.i18n.format("ITEM-PILES.Applications.ItemEditor.Title", { item_name: item.name })
if (options.extraTitle) title += options.extraTitle;
super({
id: `item-pile-item-editor-${item.id}-${randomID()}`,
title: game.i18n.format("ITEM-PILES.Applications.ItemEditor.Title", { item_name: item.name }),
title,
svelte: {
class: ItemEditorShell,
target: document.body,
Expand Down
7 changes: 5 additions & 2 deletions src/applications/item-pile-inventory-app/ListEntry.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { fade } from 'svelte/transition';
import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';
import CONSTANTS from "../../constants/constants.js";
export let store;
export let entry;
Expand All @@ -20,10 +21,12 @@
const editQuantities = store.editQuantities;
function dragStart(event) {
event.dataTransfer.setData('text/plain', JSON.stringify({
const data = {
type: "Item",
uuid: entry.item.uuid
}));
};
Hooks.callAll(CONSTANTS.HOOKS.DRAG_DOCUMENT, data)
event.dataTransfer.setData('text/plain', JSON.stringify(data));
}
</script>
Expand Down
1 change: 0 additions & 1 deletion src/applications/vault-app/VaultItemEntry.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
.grid-item {
width: 100%;
height: 100%;
background-color: rgb(56, 56, 56);
transition: transform 2s, top 2s, left 2s;
border-radius: 0.25rem;
position: relative;
Expand Down
15 changes: 11 additions & 4 deletions src/applications/vault-app/vault-shell.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
let element;
function onDragOverEvent(event) {
onDragOver(event.clientX, event.clientY);
onDragOver(event.clientX, event.clientY, true);
}
$: {
Expand All @@ -62,14 +62,14 @@
}
}
async function onDragOver(clientX, clientY) {
async function onDragOver(clientX, clientY, offset = false) {
const rect = element.getBoundingClientRect();
if (FloatingElement.id === application.id || !isCoordinateWithinPosition(clientX, clientY, rect)) {
return onDragLeave();
}
dragPositionStore.update(data => {
const x = (clientX - rect.left) - ((gridData.gridSize * data.w) / 2); //x position within the element.
const y = (clientY - rect.top) - ((gridData.gridSize * data.h) / 2); //y position within the element.
const x = (clientX - rect.left) - (offset ? ((gridData.gridSize * data.w) / 2) : gridData.gridSize/2); //x position within the element.
const y = (clientY - rect.top) - (offset ? ((gridData.gridSize * data.w) / 2) : gridData.gridSize/2); //y position within the element.
return {
...data,
...snapOnMove(x, y, { w: data.w, h: data.h }, { ...gridData }),
Expand Down Expand Up @@ -205,6 +205,10 @@
component: VaultItemEntry,
componentData: { entry: item }
})
Hooks.callAll(CONSTANTS.HOOKS.DRAG_DOCUMENT, {
type: "Item",
uuid: item.item.item.uuid
})
}
function itemStopDrag(event) {
Expand Down Expand Up @@ -242,6 +246,9 @@
if (hitApps[0].onDropData) {
return hitApps[0].onDropData(dropData);
}
if (hitApps[0]._handleDroppedEntry) {
return hitApps[0]._handleDroppedEntry(document.elementFromPoint(x, y), dropData);
}
}
const position = Helpers.getCanvasMouse().getLocalPosition(canvas.app.stage);
Expand Down
Loading

0 comments on commit 676c713

Please sign in to comment.