PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

[AlwaysOnTop] Corners scaling

Open SeraphimaZykova opened this issue 1 year ago • 8 comments

Summary of the Pull Request

Consider scaling for round corners.

PR Checklist

  • [x] Closes: #19484
  • [ ] Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • [ ] Tests: Added/updated and all pass
  • [ ] Localization: All end user facing strings can be localized
  • [ ] Dev docs: Added/updated
  • [ ] New binaries: Added on the required places
  • [ ] Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

SeraphimaZykova avatar Sep 07 '22 15:09 SeraphimaZykova

Got a screenshot? 🙂

Jay-o-Way avatar Sep 08 '22 18:09 Jay-o-Way

Where, in this all, is the display dpi/scaling factor being applied?

Jay-o-Way avatar Sep 12 '22 12:09 Jay-o-Way

Hey @Jay-o-Way, sorry for the delay, and thanks for the comments. I've updated the code considering them, please take a look on the result.

Here you can see corners with different scaling.

image_2022-09-12_19-24-20 image_2022-09-12_19-25-01 image_2022-09-12_19-25-40

SeraphimaZykova avatar Sep 12 '22 17:09 SeraphimaZykova

Thanks. I see the radius is proper now. Just a small gap between the window border and the aot border. I'm guessing that's what the +1 and -1 were for. Also see the pixels in the curve are quite sharp, but that's a small thing. (#20467) Did you try very thick borders too? Would love to see that.

Jay-o-Way avatar Sep 12 '22 19:09 Jay-o-Way

And dragging a window from one window to another (with different dpi) works?

Jay-o-Way avatar Sep 12 '22 20:09 Jay-o-Way

Changing DPI for a window works, AOT considers the current scaling of the window.

Here are thick borders as you requested: image_2022-09-13_13-30-15

SeraphimaZykova avatar Sep 13 '22 12:09 SeraphimaZykova

Looking good!

Jay-o-Way avatar Sep 13 '22 14:09 Jay-o-Way

P.S. In the last image (with yellow borders) I do not see a gap between the window and the AOT border. Is that because you made an adjustment, or because the colored border thickens both "outward" and "inward"? If I am correct (?) RoundedRect draws the border over a centralized line. That's why I thought of adding +halfthickness to left/top/right/bottom and radius.

Jay-o-Way avatar Sep 17 '22 13:09 Jay-o-Way

Good to merge?

crutkas avatar Sep 20 '22 14:09 crutkas

Is that because you made an adjustment

Yea, I did an adjustment.

If I am correct (?) RoundedRect draws the border over a centralized line. That's why I thought of adding +halfthickness to left/top/right/bottom and radius.

You're correct, the border is centralized. But in this case, we need to subtract half thickness.

SeraphimaZykova avatar Sep 20 '22 17:09 SeraphimaZykova

Here is how it looks with half-thickness subtracted.

image_2022-09-20_19-27-48 image_2022-09-20_19-41-14

SeraphimaZykova avatar Sep 20 '22 17:09 SeraphimaZykova

I don't understand. The radius of the aot border should be larger then the window border. Right? I would expect that every curve has the same center: image

pink = current outer radius = window radius black = expected outer radius (window radius + halfthickness) yellow = line to draw on (edge + halfthickness)

Jay-o-Way avatar Sep 20 '22 18:09 Jay-o-Way

I don't understand. The radius of the aot border should be larger then the window border. Right? I would expect that every curve has the same center:

So you expect it to be as it was before? 189896800-1ceb8243-0e15-4b00-91d1-33dccb017320 191326453-218697df-a187-4058-819e-e4328a5edaf1

IMO now it looks ok and not worth changing.

SeraphimaZykova avatar Sep 27 '22 08:09 SeraphimaZykova

I think the yellow one is prettier, yes. But I guess that's personal. I'm curious for a third opinion...

Jay-o-Way avatar Sep 27 '22 09:09 Jay-o-Way

I think the yellow one is prettier, yes. But I guess that's personal. I'm curious for a third opinion...

Without getting into details, just looking into the pictures, yellow does look better to me too

stefansjfw avatar Sep 27 '22 11:09 stefansjfw