Closed TornaxO7 closed 2 years ago
The normal way to "center" something over something else is to parent it to that thing with the anchor on the middle of both things, sorta like this:
(
name: "summary",
parent: "body",
hook: Hook(parent_anchor: MT, self_anchor: MB),
offset: Vec2(x: 0.0, y: 0.0),
params: TextBlock((
...
)),
),
(
name: "body",
parent: "root",
hook: Hook(parent_anchor: TL, self_anchor: TL),
offset: Vec2(x: 0.0, y: 0.0),
params: ScrollingTextBlock((
...
)),
),
Which would give you the summary text centered over the body text. We can add an image, with the text centered beside the image, like so:
(
name: "image",
parent: "body",
hook: Hook(parent_anchor: TL, self_anchor: MR),
offset: Vec2(x: 0.0, y: 0.0),
params: ImageBlock((
...
)),
),
Which from memory is what the default config does.
This isn't exactly what you asked for though, since you want the text at the top of the image. I don't think there's a way to do that yet besides manually offsetting the image:
(
name: "image",
parent: "body",
hook: Hook(parent_anchor: TL, self_anchor: TL),
offset: Vec2(x: 0.0, y: -15.0), // change this to match correctly
params: ImageBlock((
...
)),
),
HOWEVER, that got me thinking that I'll just add a text alignment option for TextBlock
so you can do it as you tried to in your initial config.
Hopefully I've answered some questions there though.
Hopefully I've answered some questions there though.
Aye! Should I close this issue?
I've added an alignment option for text blocks, it's available on master.
You should be able to use it along with the dimensions
param to center stuff easily now :):
name: "summary",
parent: "image",
hook: Hook(parent_anchor: TR, self_anchor: TL),
offset: Vec2(x: 0.0, y: 0.0),
// https://github.com/Toqozz/wired-notify/wiki/TextBlock
params: TextBlock((
text: "%s",
font: "Liberation Sans Bold 15",
ellipsize: Middle,
align: Center, // here!
...
dimensions: (width: (min: 300, max: 300), height: (min: 0, max: 0)),
)),
Hello, I'm trying to configure
wired
and I'm almost done. I just need a little help because I just can't find the issue in my config file.The problem
I'd like to have the title centered over the ScrollText.
The config file
Here's my config file:
Do you have an idea how I can fix this?