Skip to content

[zoom] fix text width - #3003

Open
Ant1r wants to merge 5 commits into
pure-data:masterfrom
Ant1r:zoom_fix_text_width
Open

Ant1r wants to merge 5 commits into
pure-data:masterfrom
Ant1r:zoom_fix_text_width

Conversation

@Ant1r

@Ant1r Ant1r commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

fixes #3002

when zooming, the -width option of text items needs to be refreshed.
This is only needed by externals such as pdlua, since Pd itself doesn't use the -width option.

Also this PR allows to display smaller texts (down to font size 2, instead of 4 before).

@Ant1r
Ant1r force-pushed the zoom_fix_text_width branch from 4b1a0e6 to d334252 Compare September 14, 2026 10:18
@Ant1r

Ant1r commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

I just tweaked that a little, I think it's good now (despite failing CI build due to osuosl.org being to slow...).

@ben-wes can you confirm that it fixes #3002? thx!

@ben-wes

ben-wes commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

@ben-wes can you confirm that it fixes #3002? thx!

thank you - this certainly fixes the wrapping issue for me!

there's one more minor issue now though that might be fixed here as well: pdlua sets the line width to 0 for shapes without border. the following line will add a border on zoom though:

if {$newwidth < 1} {set newwidth 1}

do you think it would be valid to add a check for 0 < $newwidth here?

@Ant1r

Ant1r commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

yes sure! Thanks for finding that. In fact I think the whole line is useless.

OTOH I just realized that my "fix text width" solution is actually buggy, because Tk stores the width value as integer...
You can see it on the pdlua "graphics" demo, if you zoom out to 6% then re-zoom in, back and forth, widths eventually get damaged.

I'll need to add a new tag I'm afraid.

@Ant1r
Ant1r marked this pull request as draft September 14, 2026 14:40
- use '_w' tag for both text and non-text
- don't force zero-width to 1
@Ant1r
Ant1r force-pushed the zoom_fix_text_width branch from af4b36f to 1832cfe Compare September 14, 2026 17:21
@Ant1r

Ant1r commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

Hope it's OK now.
@ben-wes plz test!

@Ant1r
Ant1r marked this pull request as ready for review September 14, 2026 17:29
@ben-wes

ben-wes commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

test!

thanks - lgtm!

@Ant1r

Ant1r commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

Cool. @umlaeute maybe this can be merged to develop?

@Ant1r

Ant1r commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

There was another bug, only visible with horizontal slider at moderate zoom out, here at 89%:
Capture d’écran du 2026-09-16 17-51-53

The solution is to round the width to nearest integer. Last commit implements that.

@Ant1r

Ant1r commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

BTW I fixed a rounding bug with default_zoom when is less than 100%.
Sorry for being off-topic, but I discovered this when trying to configure default zoom to 89%, to help fixing the hslider bug...

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.

[zoom] handle text -width when zooming

2 participants