Edit Mode Widgets - ArnoldSmith86/virtualtabletop GitHub Wiki
The Widgets button of the Edit Mode Menu (right sidebar) is a system for adding widgets to the room and for keeping a personal collection of widgets.
This is a method for adding widgets to the room and for saving to local storage widgets and groups of widgets that are frequently used.
When you click on that button you get a system for adding and managing widgets that looks like the following:
At the top, you get a legend explaining the orange lightning bolt and the red star. The red star is just a visual reminder that normally there will only be one of those kinds of widgets in a room. The orange lightening bolt means that a routine will be triggered when the widget is added to the room. For example, game pieces trigger a routine to choose a color. A third symbol, an amber warning triangle, marks a saved widget that was saved in a game whose Legacy Mode features differ from those of the current game; hovering over it names the modes that differ. Adding such a widget to the room asks you to confirm first, because Legacy Mode features can change how the widget behaves in its new game. Also at the top is a "Filter" search bar. Typing in that bar will limit the results displayed. The filter works on both the name of the widget and the type of widget. Finally, next to the search bar are 4 icons. The first one displays the widgets in a list, as in the image above. The second icon displays the widgets in a grid, as in the following:
The third icon in the top area will save whatever widget or widgets are currently selected. The last icon in the top area
allows editing of widget information as well as uploading and downloading of widgets. When clicked, the display changes to something like this:
Below the top area are two large blue bars: "On The Server" and "In Local Storage". The widgets on the server are the same ones that can be added from the Add Widget overlay. You cannot edit or change these in any way. If you have clicked the pen edit icon, you can download them using the download button to the right of the widget.
Widgets that you have saved or uploaded from saved files are in the "In Local Storage" area. At the right edge of that blue bar are sort buttons that allow you to sort widgets by time, name, or type in ascending or descending order. You can also create a group of widgets that will be arranged and maintained within their own group. To create a group, drag and drop a widget from the list onto the "+ New Group" label and give the group a name. To add more widgets to that group, drag and drop them from the list onto the group name. Groups will be indicated with dark gray bars. A double line separates the last group from the individual widgets. Once a widget is in a group, it can be dragged to another group but cannot be put back into the list of individual widgets. When sorting, groups are sorted in the same way with the buttons, but will always be listed at the top before individual widgets. Note that these groups are for organizing how the widgets are displayed, like a folder. The widgets still must be individually added to a room. If you want several widgets actually combined into a single widget for purposes of adding to a room, select multiple widgets in the editor before pressing the save icon. They will be listed as a single widget (you should consider changing the name to reflect this), but all of them get added to the room together.
When the pen edit icon is pressed, for widgets in local storage you get several options. You can change the name of a group or widget by typing a new name. You can check the box as a reminder that the widget is "Unique" (and give it a red star in the display). You can delete the widget from the saved widgets (but not the room!) by clicking on the trash can icon. You can download an individual widget to a .json file by clicking on the download arrow icon to the right of the widget. You can download all of the widgets in local storage to a single .json file by clicking on the download arrow icon at the right of the blue bar for "In Local Storage". You can upload a .json file by clicking on the upload arrow icon.
To add a widget to the room, you can click on the plus icon to the right of the widget. This will place the widget in the room at pre-defined coordinates; for custom widgets, this is the x/y values when the widget was saved. You can also drag and drop a widget to any location you want. Widgets get an id based on the id of the widget as it was saved. If more than one widget of the same type is added, then subsequent widgets get a 1, 2, 3, etc. added to the end of their id. If you want to create a widget that triggers a routine when it is added to the room in edit mode, put a editorAddToRoomRoutine on the widget before you save it. It will appear in orange in the JSON unlike other routines. It will be saved with the widget in local storage, but editorAddToRoomRoutine will trigger and then erased from the widget when it is put into the room. This routine type is only for edit mode and not for play mode.