Skip to content

Commit

Permalink
0.4.10
Browse files Browse the repository at this point in the history
  • Loading branch information
averrin committed Nov 15, 2022
1 parent c1f1104 commit aef3034
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 26 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
All notable changes to this project will be documented in this file. Dates are displayed in UTC.

## [Unreleased]
## [0.4.9 - 0.4.10](https://github.com/averrin/alpha-suit/compare/0.4.9...0.4.10)
Fixed:
* Ui Scale doenst apply
* Drag and drop actors & items from Browser doesn't work (fixed actor to canvas and items to an actor sheet)

## [0.4.8 - 0.4.9](https://github.com/averrin/alpha-suit/compare/0.4.8...0.4.9)
Fixed:
* Doraco UI breaks notification style

Added:
* Kobaldworks Data Inspector integration
* Better pf2e support
* Koboldworks Data Inspector integration
* Better pf2e support (Browser filters and tabs)

## [0.4.7 - 0.4.8](https://github.com/averrin/alpha-suit/compare/0.4.7...0.4.8)
Fixed:
Expand Down
7 changes: 2 additions & 5 deletions src/modules/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,10 @@ export function initSettings(app) {

game.settings.register(moduleId, SETTINGS.UI_SCALE, {
name: 'UI scale',
hint: 'UI scale in range [0.25, 3]. Will preview but requires refresh to apply.',
hint: 'You can use a scroll wheel for fine tuning.',
config: false,
type: Number,
default: 1,
onChange: value => {
// debouncedReload();
},
range: {
min: 0.1,
max: 2,
Expand Down Expand Up @@ -192,7 +189,7 @@ export function initSettings(app) {
hint: "This value is used for auto expanding two-pane windows",
scope: "client",
config: false,
default: 920,
default: 1000,
type: Number,
});

Expand Down
36 changes: 36 additions & 0 deletions src/modules/stores.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { filterItemPredicate } from "crew-components/helpers";
import { isPremium } from "crew-components/premium";
import { helpContent } from "./help_content.js"
import { settingsContent } from "./settings_content.js"
import { tick } from "svelte";
let tagSource = moduleId;


Expand Down Expand Up @@ -222,7 +223,42 @@ function updateDropHandlers(sheet) {
}
}

async function importDoc(data) {
const pack = game.packs.get(data.compendium);
const doc = await pack.getDocument(data._id);
let newDoc = await doc.collection.importFromCompendium(pack, doc.id);
data.id = newDoc.id;
data.uuid = newDoc.uuid;
return data;
}

function initDropHandler() {
Hooks.on("dropCanvasData", (canvas, data) => {
if (data.type == "Actor" && data.compendium) {
tick().then(async _ => {
data = await importDoc(data);
canvas.tokens._onDropActorData({ altKey: false, preventDefault: _ => { } }, data);
})
return false;
}
return true;
})

Hooks.on("dropActorSheetData", (actor, sheet, data) => {
if (data.type == "Item" && data.compendium) {
tick().then(async _ => {
data = await importDoc(data);
sheet._onDropItem({ altKey: false, preventDefault: _ => { } }, data);
})
return false;
}
return true;
})
}

export function initStores() {
initDropHandler()

let sys = get(systems)[globalThis.game.system.id] || get(systems)["*"];
if (sys.id == "*") {
sys.id = globalThis.game.system.id;
Expand Down
13 changes: 2 additions & 11 deletions src/view/components/DocumentThumb.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,10 @@
async function drag(e) {
let id = $item.id;
let type = $currentCollection.documentName;
let data = { type, id, data: $item.data, uuid: $item.uuid };
let type = $item?.compendium?.metadata?.type ?? $currentCollection.documentName;
let data = { type, id, data: $item.data, uuid: $item.uuid, compendium: fromCompendium?.metadata?.id, _id: $item._id };
let sData = { data: JSON.stringify(data) };
e.dataTransfer.setData("text/plain", sData.data);
if (fromCompendium) {
const doc = await fromCompendium.getDocument($item._id);
let newDoc = await doc.collection.importFromCompendium(fromCompendium, doc.id);
type = doc.collection.documentName;
id = newDoc.id;
sData.data = JSON.stringify({ type, id });
ui.notifications.info(`Imported: ${doc.name}`);
e.dataTransfer.setData("text/plain", sData.data);
}
}
let thumb;
Expand Down
8 changes: 0 additions & 8 deletions src/view/settings/GeneralSettings.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<script>
import { SETTINGS } from "../../modules/constants.js";
import SettingsInput from "./SettingsInput.svelte";
import { getContext } from "svelte";
const { application } = getContext("external");
const { scale } = application.position.stores;
</script>

<div class="ui-bg-base ui-p-2 browser-settings ui-flex ui-flex-col ui-gap-2 ui-h-full">
Expand All @@ -22,10 +18,6 @@
<SettingsInput
type="float"
key={SETTINGS.UI_SCALE}
on:change={(e) => {
if (e.detail < 0.25 || e.detail > 3) return;
scale.set(e.detail.value);
}}
/>

<SettingsInput key={SETTINGS.WINDOW_WIDTH_EXPANDED} />
Expand Down

0 comments on commit aef3034

Please sign in to comment.