Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contextual Sidebars Module, Grouping, Deterministic Colour Generation #454

Open
wants to merge 38 commits into
base: master
Choose a base branch
from

Conversation

timothycdc
Copy link
Contributor

@timothycdc timothycdc commented May 21, 2024

Overview

Add functionality to set 'groups of symbols', used for HLP25. Also adds a deterministic colour generator for groups, using poisson-disk sampling for distantly-spaced colours that do not clash with existing UI colours.

This feature also introduces a UI library for a 'contextual sidebar' that can be programmatically called and accept user input via buttons or dialog, and modify the model in turn. One key example of a sidebar is the group selection sidebar, shown below.

Developer Mode

  • Support for modifying groups and tracking groups
  • Plenty of useful code examples for sidebars for others to follow
  • Extra tests and demos for added features

Contextual Sidebars

  • Sidebars are called with dispatch and have the ability to modify the existing model
  • Sidebars are dynamic and can change with the current Model. This allows them to respond to user changes on the sheet.
  • Sidebars have options that make them user-cancellable, either statically or dynamically under certain conditions. This is shown through the (x) button in the top right corner.
  • Sidebars also have support for buttons that are dynamic and can also modify the sheet. This is because dispatch is also passed to the buttons (allowing them to send messages)
  • Sidebars also have support for dialog bodies that can contain text and int, with the latter having features to bound a min or max int and overflow prevention.
  • Their implementation is similar to UIPopups.

Group Selection Sidebar

  • A group selection sidebar that normally cannot be dismissed by the user, prompts the user to choose components to add them to a single group. A new colour is automatically generated for a new group created
  • Groups are stored in SymbolT.Model
  • Added helpers in Groups.fs to create new groups, add symbols to a group, delete symbols from a group, and delete whole groups.
  • Edge case: (x) button for group selection sidebar only shows when there are zero ungrouped components left on the sheet

Screenshots

image image image image image image image image image

Type Defs:

module SymbolT =
...
    /// Represents all the symbols and ports on the sheet
    type Model = {
     ...

        GroupMap: Map<GroupId, ComponentId list>
        GroupInfoMap: Map<GroupId, GroupInfo>
        GroupColourLookupMap : Map<ComponentId, string>
        }
    type GroupId = GroupId of string
    type GroupInfo = {
        Id: GroupId
        CreationDate: DateTime
        Colour: string
    }

Other notes/current issues:

  • Still need to deal with groups in SymbolT.Model persisting across changing projects/sheets.
  • Should groups be loaded/saved into the project file? Currently not implemented
  • MergeWires, SplitWires, Wire Label and Not Connected cannot be put into groups.

Overcomplicated draft selection UI.

will port this to DevMode
Overcomplicated draft selection UI.

will port this to DevMode
Overcomplicated draft selection UI.

will port this to DevMode
Overcomplicated draft selection UI.

will port this to DevMode
- Handle deletion of symbols by also deleting them from groups (symbolUpdate)
- try to use more granular SymbolT.Model instead of SheetT.Model where possible
- Contextual Sidebar has dynamic title text and classes
- Improved comments all around
- Current issues: phantom groups when changing sheets / groups are not saved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant