Bloc icon indicating copy to clipboard operation
Bloc copied to clipboard

Need to draw a border to a BlRopedTExt

Open LANDAISB opened this issue 10 months ago • 1 comments

The purpose is to add a border with a different color than foreground to a BlTextElement such as here (for sample):

sampleBorderBlocText

We need to set basic parameters of the border such as thickness (width) and color.

LANDAISB avatar Apr 09 '24 15:04 LANDAISB

@tinchodias this is our tomorrow discussion :-)

labordep avatar Apr 09 '24 16:04 labordep

Hello, I made it work with an attribute, that allows user to send border: to a roped text, so it can be specified for a sub-sequence of the text like this:

Screenshot 2024-04-18 at 22 58 02

Code:

aText := 'BlocBloc' asRopedText.
aText fontSize: 250.

(Color wheel: aText size) withIndexDo: [ :aColor :index |
	(aText from: index to: index) background: aColor ].

(aText from: 1 to: 3)
	foreground: Color white;
	border: (BlBorder builder
		paint: Color black;
		width: 10;
		dashArray: #(20 20);
		capSquare;
		build).

(aText from: 5 to: 7)
	foreground: Color black;
	border: (BlBorder builder
		paint: Color white;
		width: 10;
		dashArray: #(20 20);
		capRound;
		build).

element := BlTextElement new
	text: aText;
	position: 20 asPoint;
	background: Color gray;
	yourself.

aSpace := BlSpace new.
aSpace root
	addChild: element;
	background: Color darkGray.
aSpace extent: 1000 @ 300.
aSpace show.

Do you think this is good for your needs? @labordep @LANDAISB

tinchodias avatar Apr 19 '24 03:04 tinchodias

Hello, Yes it seems very good. Thank you.

In which branch can we test this ?

LANDAISB avatar Apr 19 '24 07:04 LANDAISB

Thanks @tinchodias!

labordep avatar Apr 19 '24 09:04 labordep

I have to clean up a bit and push it. Notes:

  • It can be extended easily to have outskirts (it's a separate object that BlElement points directly, I mean the BlBorder doesn't know about outskirts)
  • Right now it is rendered only above the text, but it could be changed easily to be below it. Do we keep that for other moment, or do you prefer to have this options?

tinchodias avatar Apr 19 '24 18:04 tinchodias

These options are intersting, but we do not need them for the moment. So I think you can postpone these options.

LANDAISB avatar Apr 22 '24 07:04 LANDAISB

yes but if the gap to have then finished work is not too expensive, I think that the better is to do it now.

plantec avatar Apr 22 '24 17:04 plantec