It is currently October 22nd, 2024, 10:24 pm

Any better solution for snappable skin margins on a dynamic dimension skin?

Get help with creating, editing & fixing problems with skins
Crest
Posts: 158
Joined: August 16th, 2013, 12:47 pm

Re: Any better solution for snappable skin margins on a dynamic dimension skin?

Post by Crest »

Interesting concept! Keep in mind I wasn't expecting anyone to write any code as it seems there are trade-offs to be had with any approach atm.

The above attached approach is useful if one doesn't mind shadows being narrowed on mouse over and move, both on the skin being interacted with and all other skins simultaneously, and instead only needing them to appear at rest. Also if the skin dimension transition jerkiness can be mitigated.

While the dual skin approach could be used as-is if one knows the skins will only ever be on the desktop Z position and not overlap other skins or windows.

What would be nice is if Rainmeter had the ability to configure offsets from the edges to define where the snappable area should be (such as the syntax to `DragMargins`), that would work for dynamic width skins. That way one could keep the main skin + shadow in one skin and effectively define a custom bounding box. The downside (if even possible) is if one wanted to dynamically adjust the bounding box/snappable area offset the `[Rainmeter]` section lacks support for `DynamicVariables`, though if it did it'd mean that without any overall skin dimension changes one could change the skin's bounding box on the fly.

Otherwise if the ability to detect z-index were possible in a more fine-grained way such a dual skin approach may similarly become more feasible, for scenarios where overlapping of skins/windows is expected.

If one had shadows wider than the inter-skin margins (such as the illustrations above) and cared about avoiding shadow overlap side-by-side* then the dual skin concept would be the only feasible option (if dynamic z-index were readable), as it would allow for shadows to be placed below both both skins' z-index if they're detected by coordinates to be side-by-side (this was intentionally applied in the static demo further above with the pink 1px borders), while otherwise changing their z-index to follow the main skin if they're not side-by-side as (seen in the GIF demo).



* Existing examples that do this:
  • macOS Big Sur's Notification Center widgets. It applies two things: a subtle background 'shadow' that inherits the wallpaper's colors to provide more widget foreground contrast (most obviously if there are regular windows beneath) and additionally applies per-widget regular shadows (which extend ever so slightly into each other's). All of which are behind the actual widget content. Tbf if only replicating the per-widget shadows here, since they don't extend into the content areas, even just having custom bounding box would work while one could add something like MagicMeter for inherited background colors as a separate skin overlay.
  • CSS when using the `::before` pseudo element for shadows to effectively place them behind all adjacent content and avoid overlap.
User avatar
Yincognito
Rainmeter Sage
Posts: 8537
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Any better solution for snappable skin margins on a dynamic dimension skin?

Post by Yincognito »

Crest wrote: June 12th, 2024, 10:44 am Interesting concept!
[...]
[*] CSS when using the `::before` pseudo element for shadows to effectively place them behind all adjacent content and avoid overlap.
[/list]
Yeah, it was a quick and dirty approach, just to get the idea - I only used mouse over / leave since there were no skin-wide OnDragStart / OnDragStop actions. Regarding the Z index, I'm not sure that it should be the focus, maybe the load order can cover that in this case, I don't know - but even so, a double skin scenario cannot handle always on top positions anyway, so IMHO it's a dead end regardless. The single skin system has the most potential here, but yeah, dynamically configuring the snap margins would be needed for a built-in solution.

I know you didn't mention that code was needed, but again, one can generally analyze things all he wants (and personally I'm not against it, I can do it too sometimes), yet without actually doing something about it (which means some code in this case), it's difficult to precisely assess the possibilities in more complex situations - hence the sample above. Either way, Rainmeter skins are by design made to start at 0,0 and end where the last (partially or fully) opaque pixels end, and that is the main problem and contradiction in shadows extending past the "default" skin boundaries. In a way, you want to have your cake and eat it too in this case. :D

Since you mentioned CSS, you can try using your own local webpage with the WebView plugin to do your thing, although given the fact that the WebView "measure" is still contained within the skin boundaries and subject to the same opaque pixel system, I would be cautious in believing that it solves the problem...
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth