earlSt1 / vtt-compendium-folders

Collapsable folders in the compendium directory and folder structures inside compendiums for FoundryVTT
21 stars 18 forks source link

Grid, Zoom, Resize #199

Open c-trimm opened 1 year ago

c-trimm commented 1 year ago

This was a bit thrown together, but it adds the ability to resize the compendium window, switch between a list and grid view of compendium items, and to zoom (scale) the item thumbnails. It also stickies the folder titles as you scroll so you can always see what folder you're in.

This is really handy when using compendiums to browse and pull in prefabs and such.

Happy to make whatever changes necessary.

c-trimm commented 1 year ago

Couple examples of what this looks like in practice: image

earlSt1 commented 1 year ago

Hey, this looks really cool! I found a few issues while briefly testing though. When using the grid mode you cant click on the entries to view them, and the stickied headers work a bit strange when you have multiple folders open.

I'm just about to push a release but I'll definitely include this in the next one if we can get those bits sorted :smile:

c-trimm commented 1 year ago

@earlSt1 this is what I get for hyper focusing on prefabs, where it isn't useful to open them on click. I'll take a look. As for the stickied headers working strange, can you elaborate a bit further? They seem to work fine for me - the only quirk I've noticed is that, since each level of header is indented, the left side of the parent header is slightly visible. I didn't think that was a huge deal though, personally, but it's not my plugin. :)

earlSt1 commented 1 year ago

Yeah I found it a bit weird how opening multiple folders would cause them to be stickied at the top, so they would kind of stack on top of eachother if you scrolled down. It just looked a bit strange to me but you're right its not a big deal

c-trimm commented 1 year ago

@earlSt1 alright, I solved the icon-clicking issue, and I also noticed an issue with searching that was breaking these changes so I had to make some changes to fix that. One thing to note is that I changed the search method to use textContent rather than innerText because when you were in grid mode, search didn't work due to the title being display: none. I tested a few different compendiums and the sidebar and it seems to work fine. Let me know if you notice any issues!

Thanks!

c-trimm commented 1 year ago

There's one other issue that's driving me nuts, but I'm at a loss on how to fix it - sometimes when you click an item to view it then close that item, the compendium re-renders, which causes it to lose the grid/zoom state and revert back to default. Let me know if you have any ideas on how to fix.

earlSt1 commented 1 year ago

Awesome, ill have another look into what could cause the compendium to refresh tomorrow. Usually its when you update an item. To get around this i store the previous searched term and the previous open folders as module settings. I suppose you could store the previous grid/list setting and zoom level?

c-trimm commented 1 year ago

@earlSt1 Sorry this took a while - I did as you suggested and added the display mode and zoom level to the settings, so re-rendering no longer has that issue.

Let me know if you notice any other bugs or anything you'd like improved. Thanks!

earlSt1 commented 1 year ago

Hey, sorry I havent been chasing this up. I've been getting ready for the v11 migration. Just so you know, I'm planning on retiring the module when v11 hits since it has been pretty much entirely absorbed into core. I can test and merge this into the V10 version though once i have some time.