Skip to content

Clean up geometries #784

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

Merged
merged 7 commits into from
May 28, 2025
Merged

Clean up geometries #784

merged 7 commits into from
May 28, 2025

Conversation

tinchodias
Copy link
Collaborator

  • implement Histogram
  • Remove other unused geometries

@tinchodias
Copy link
Collaborator Author

Demo:

Screen.Recording.2025-05-27.at.16.00.03.mov
ramp := (0 to: 1 by: 0.15).
ramp := ramp ** 2.
orientations := #(beHorizontal beHorizontalInverted beVertical beVerticalInverted).
colors := Color wheel: orientations size.

width := 150.
height := 100.
gap := 10.
s := BlSpace new.
s extent: gap + (orientations size * (width + gap)) @ (50 + height).
s root layout: (BlLinearLayout new cellSpacing: gap; yourself).

orientations withIndexDo: [ :each :index |
		| cell g |
		cell := BlElement new.
		cell clipChildren: false.
		cell layout: BlLinearLayout vertical.
		cell border: (BlBorder paint: Color black width: 0.5).
		cell margin: (BlInsets vertical: gap).
		cell constraintsDo: [:c |
			c horizontal fitContent.
			c vertical fitContent ].
		
		g := BlHistogramGeometry new.
		g values: ramp.
		g perform: each.

		cell addChild: (BlElement new
			border: (BlBorder paint: Color black width: 1);
			width: width;
			height: height;
			background: (colors at: index);
			geometry: g;
			addEventHandlerOn: BlMouseEnterEvent do: [ :evt | evt target opacity: 0.5 ];
			addEventHandlerOn: BlMouseLeaveEvent do: [ :evt | evt target opacity: 1.0 ];
			yourself).

		cell addChild: (BlTextElement new
			text: each asString asRopedText;
			editorMeasurement;
			constraintsDo: [:c | c linear horizontal alignCenter ];
			yourself).

		s root addChild: cell ].

"s root exportAsPNG."
s show.

@tinchodias tinchodias merged commit 8379755 into dev May 28, 2025
10 of 13 checks passed
@tinchodias tinchodias deleted the CleanUpGeometries branch May 28, 2025 14:18
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