bwmilby / SvgIconTool

#LiveCode tool to manage SVG Icon Families
MIT License
3 stars 3 forks source link

add a search by name #2

Open macMikey opened 1 year ago

macMikey commented 1 year ago

this project could use a search function. if i want a checkbox across all icon families, i could pull them all up at the same time

bwmilby commented 1 year ago

Yes, that could be useful.

bwmilby commented 1 year ago

Thinking about the best way to present this option with the limited space in the stack design. Initially thinking that a floating window for the search UI would be one way to handle this.

bwmilby commented 1 year ago

I'm thinking that part of this would involve creating two special families. The first would be the search result family. The second would be a super-set family that includes everything (for searching across the entire library of icons).

macMikey commented 1 year ago

i was rolling this around in my head, thinking about how to solve the same problem. one could also iterate through all the families, get the names, and search. the problem with that is there can also be many other icons that are not installed with LC, but are available, e.g. your original version of this project. another option might be to, at stack load, build a couple of arrays, one indexed by family, and one by name.

bwmilby commented 1 year ago

Since the filter command is so efficient, creating a text list and then filtering would probably be the easiest. Would just need to include a delay (no bounce) on the field so it only updated the list when typing was paused (did that on the dictionary to improve search responsiveness). Currently I don't display icon labels in the grid (only on hover) but for a search it would probably be more important to see them. PowerButton would make that easy (or another community button widget that does SVG icons). The code that paints the icons would need to be adjusted to work off of a list directly though (with family and icon components). Currently it just gets the keys of the family array and shows the correct chunk. I'm thinking that is going to be better than building a new combined array and adjusting it.

Initial thought would be to add a magnifying glass (search) icon to the grid card. It would open a palette that allowed the user to select the family to search (with an additional option for all). Default would be the currently selected family. Once a search was started, the grid would start updating with the found icons. Implementing the select all/none and selection in general will take some consideration (currently it sets a flag in the array that holds the family, but there won't be a full array - thinking out loud for now).