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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
6892b93
dev mode ported to master
timothycdc Apr 10, 2024
5534320
revert accidental change of SelectedComponentView
timothycdc Apr 10, 2024
3a9fa02
feat: persist RightSelection scroll pos on update
timothycdc Apr 10, 2024
854a442
renamed vars to reflect RightSelection
timothycdc Apr 10, 2024
8204fe9
DevMode Done
timothycdc Apr 20, 2024
e7332c3
Feature: properly print (custom) comp types
timothycdc Apr 20, 2024
69e9899
Devmode: Sort Ports by PortNumber
timothycdc Apr 20, 2024
b2f99a3
New feature: dragToSelect dimensions/ruler
timothycdc Apr 21, 2024
98ef32b
Draft Selection UI
timothycdc Apr 20, 2024
ef17136
Dev Mode Groupings
timothycdc Apr 22, 2024
a4713d5
Cleaned up comments
timothycdc Apr 22, 2024
917a115
Draft Selection UI
timothycdc Apr 20, 2024
a661bae
Dev Mode Groupings
timothycdc Apr 22, 2024
a5998af
Merge branch 'tdc21_select_ui' of https://github.com/timothycdc/issie…
timothycdc Apr 22, 2024
4828f7a
Rename selection UI + features and types
timothycdc Apr 26, 2024
43b8b92
Update Selection UI and Colour Gen
timothycdc Apr 28, 2024
22e7483
codeblock, streamline model vars, comments
timothycdc May 4, 2024
d6516e6
Update MainView.fs
timothycdc May 4, 2024
ed40ea9
Draft Selection UI
timothycdc Apr 20, 2024
b2f65db
Dev Mode Groupings
timothycdc Apr 22, 2024
01760a8
Draft Selection UI
timothycdc Apr 20, 2024
7c06ca6
Dev Mode Groupings
timothycdc Apr 22, 2024
56d7d5d
Rename selection UI + features and types
timothycdc Apr 26, 2024
39d1e86
Update Selection UI and Colour Gen
timothycdc Apr 28, 2024
802b848
codeblock, streamline model vars, comments
timothycdc May 4, 2024
59a1b97
Merge branch 'tdc21_select_ui' of https://github.com/timothycdc/issie…
timothycdc May 4, 2024
48cae6e
Fixed issue where sidebar scroll doesn't persist
timothycdc May 4, 2024
c2421c5
Sticky Tabs+ContextualSidebar autoscrolls up on call
timothycdc May 4, 2024
71234e4
colour algorithm working + reflected in groups
timothycdc May 7, 2024
6583875
symbol colouring, ported groups to symbolmodel
timothycdc May 7, 2024
2947529
Bug fix: instant group colour updates
timothycdc May 7, 2024
819b9eb
Cleanup + tweak var names for better understanding
timothycdc May 11, 2024
fba0bc0
selection UI with dialogs + examples
timothycdc May 12, 2024
f26c956
Create Groups.fs, CSS tweaks, scroll bug fix
timothycdc May 12, 2024
361c22f
contextual sidebars for grouping
timothycdc May 12, 2024
05f46d9
Close sidebars after project/sheet file actions
timothycdc May 12, 2024
4c4acf9
Fixes after feedback
timothycdc May 20, 2024
09d2336
symbolUpdate bugfix, tweaks, improvements, comments
timothycdc May 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
184 changes: 102 additions & 82 deletions src/Renderer/Common/CommonTypes.fs

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions src/Renderer/Common/DrawHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ type PortLocation = {
R: float
}

type MouseOp =
type MouseOp =
/// button up
| Up
/// button down
| Down
/// Move with button up
| Move
| Move
/// Move with button Down
| Drag

Expand All @@ -46,7 +46,7 @@ type MouseT = {
/// Record to help draw SVG circles
type Circle = {
/// Radius of the circle
R: float
R: float
/// color of outline: default => black color
Stroke: string
/// width of outline: default => thin
Expand Down Expand Up @@ -108,7 +108,7 @@ let getTextWidthInPixels (font:Text) (txt:string) =
canvasWidthContext.font <- askedFont
//printf "Measururing '%s' -> '%s' with txt '%s' - fontSize=%s, sizeInpx = %.2f" askedFont canvasWidthContext.font txt font.FontSize sizeInPx
let textMetrics = canvasWidthContext.measureText(txt)
let ms = textMetrics.width
let ms = textMetrics.width
ms

/// Default line, change this one to create new lines
Expand Down Expand Up @@ -180,7 +180,7 @@ let uuid():string = System.Guid.NewGuid.ToString()

// ----------------------------- SVG Helpers ----------------------------- //

/// Makes a line ReactElement, wildcard inputs as position can be a number or a string
/// Makes a line ReactElement, wildcard inputs as position can be a number or a string
let makeLine (x1: 'a) (y1: 'b) (x2: 'c) (y2: 'd) (lineParameters: Line) =
line [
X1 x1
Expand Down Expand Up @@ -248,8 +248,8 @@ let makePath (startingPoint: XYPos) (startingControlPoint: XYPos) (endingControl
SVGAttr.StrokeLinecap pathParameters.StrokeLinecap
SVGAttr.Fill pathParameters.Fill
] []
/// Makes a polygon ReactElement, points are to be given as a correctly formatted SVGAttr.Points string

/// Makes a polygon ReactElement, points are to be given as a correctly formatted SVGAttr.Points string
let makePolygon (points: string) (polygonParameters: Polygon) =
polygon [
SVGAttr.Points points
Expand All @@ -258,12 +258,12 @@ let makePolygon (points: string) (polygonParameters: Polygon) =
SVGAttr.Fill polygonParameters.Fill
SVGAttr.FillOpacity polygonParameters.FillOpacity
] []


/// Makes a circle ReactElement
let makeCircle (centreX: float) (centreY: float) (circleParameters: Circle) =
circle
[
[
Cx centreX
Cy centreY
R circleParameters.R
Expand All @@ -272,36 +272,36 @@ let makeCircle (centreX: float) (centreY: float) (circleParameters: Circle) =
SVGAttr.Stroke circleParameters.Stroke
SVGAttr.StrokeWidth circleParameters.StrokeWidth
] []

/// Makes a text ReactElement
let makeText (posX: float) (posY: float) (displayedText: string) (textParameters: Text) =
text [
X posX;
Y posY;
X posX;
Y posY;
Style [
TextAnchor textParameters.TextAnchor
DominantBaseline textParameters.DominantBaseline
FontWeight textParameters.FontWeight
FontSize textParameters.FontSize
FontFamily textParameters.FontFamily
Fill textParameters.Fill
UserSelect textParameters.UserSelect
UserSelect textParameters.UserSelect
]
] [str <| sprintf "%s" (displayedText)]

/// makes a two-line text ReactElement
/// Dy parameter determines line spacing
let makeTwoLinesOfText (posX: float) (posY: float) (line1: string) (line2: string) (textParameters: Text) =
text [
X posX;
Y posY;
X posX;
Y posY;
Style [
TextAnchor textParameters.TextAnchor
DominantBaseline textParameters.DominantBaseline
FontWeight textParameters.FontWeight
FontSize textParameters.FontSize
Fill textParameters.Fill
UserSelect textParameters.UserSelect
UserSelect textParameters.UserSelect
]
] [tspan [] [str line1]; tspan [Dy "1.2em"] [str line2] ]

Expand All @@ -317,13 +317,13 @@ let getColorString (col: CommonTypes.HighLightColor) =
/// Calculates if two bounding boxes intersect by comparing corner coordinates of each box
let boxesIntersect (box1: BoundingBox) (box2: BoundingBox) =
// Requires min and max since H & W can be negative, i.e. we don't know which corner is which automatically
// Boxes intersect if there is overlap in both x and y coordinates
// Boxes intersect if there is overlap in both x and y coordinates
min box1.TopLeft.X (box1.TopLeft.X + box1.W) < max box2.TopLeft.X (box2.TopLeft.X + box2.W)
&& min box2.TopLeft.X (box2.TopLeft.X + box2.W) < max box1.TopLeft.X (box1.TopLeft.X + box1.W)
&& min box1.TopLeft.Y (box1.TopLeft.Y + box1.H) < max box2.TopLeft.Y (box2.TopLeft.Y + box2.H)
&& min box2.TopLeft.Y (box2.TopLeft.Y + box2.H) < max box1.TopLeft.Y (box1.TopLeft.Y + box1.H)





Loading