-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sidebar-resizer: change $:/themes/...
tiddlers
#8663
base: master
Are you sure you want to change the base?
Sidebar-resizer: change $:/themes/...
tiddlers
#8663
Conversation
Run & review this pull request in StackBlitz Codeflow. |
Confirmed: BurningTreeC has already signed the Contributor License Agreement (see contributing.md) |
sorry for tagging you 😸 The calculations are now done in wikitext in the procedures. |
This works now with all absolute css metrics: Including percentage, which is easy to calculate. The internal calculations are all done in pixel, so this first converts everything to pixel, then calculates, then converts back to the corresponding value. I don't know if this can also support other relative css metrics... |
As I said above, in fixed-fluid mode I'm not settled about how the gap between story-river and sidebar should be handled. |
@BurningTreeC -- I did checkout this branch and did run it, but I can not find any resizer. I think I'm missing something |
Now the "tight" and "tight-heavier" themes use their own metrics for "storywidth", "storyright", "sidebarwidth", "tiddlerwidth" and the new metrics "storypaddingleft" and "storypaddingright" The centralised theme also uses its own metrics for where it's worth it Now I don't want to change any more here until some feedback if I'm going in the wrong direction or not |
@BurningTreeC Is it possible to reuse this in other layouts, like in your multi-column layout to resize columns? Surprising that this can be done in pure WikiText. I think the update logic nees some debounce, for example use https://tiddlywiki.com/#RefreshThrottling . https://github.com/Gk0Wk/TiddlySeq/tree/master/src/sidebar-resizer has some throttle logic using requestAnimationFrame in its TS. |
Hi @linonetwo |
@Jermolene @pmario @linonetwo @saqimtiaz |
I can't try it right now, but doesn't that make the sidebar resizing jerkier? |
No because refresh throttling isn't used for the refresh of the styleWidgetNode in render.js |
Maybe not having refresh throttling on the styleWidgetNode is a mistake? |
} | ||
|
||
<%if [{$:/themes/tiddlywiki/vanilla/options/sidebarlayout}match[fluid-fixed]] %> | ||
|
||
html .tc-sidebar-resizer { | ||
left: clamp(calc({{$:/themes/tiddlywiki/vanilla/metrics/storyleft}} + {{$:/themes/tiddlywiki/vanilla/metrics/storyminwidth}}),calc(100% - {{$:/themes/tiddlywiki/vanilla/metrics/sidebarwidth}}),calc(100% - {{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}})); | ||
left: clamp(calc({{$:/themes/tiddlywiki/vanilla/metrics/storyleft}} + {{$:/themes/tiddlywiki/vanilla/metrics/storyminwidth}}),calc(100% - {{$:/themes/tiddlywiki/tight/metrics/sidebarwidth}}),calc(100% - {{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}})); | ||
} | ||
|
||
<% endif %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean, if I install a user developed theme, then I have to edit it like above to support the sidebar resizer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @kookma - I don't think it's possible to make the resizer compatible with all possible themes out of the box
That's because one theme uses these metrics, another theme uses different metrics, one theme has the sidebar at the left, the other at the right...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But seems Gk0Wk's JS version sidebar-resizer can adapt to every themes? At least itonnote theme haven't done any adaption to it. Of course it has limintation, like it force the unit to be vw
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here it was asked to change the theme metrics directly. If a theme uses different metrics tiddlers than the vanilla ones it becomes a bit more complex. But I think we could make it easier for other themes to adapt the resizer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@linonetwo - having a look at Gk0Wk's JS resizer at https://gk0wk.github.io/TiddlySeq/#%24%3A%2Fplugins%2FGk0Wk%2Fsidebar-resizer%2Fhook.js I doubt that it can work with fixed-fluid vanilla mode for example. In fact, on the demo page try to set the mode to fixed-fluid... It changes the sidebarwidth only and does not adapt to other themes or theme-options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's possible to make the resizer compatible with all possible themes out of the box
Thank you for the clarification! So, some default core themes will support the sidebar resizer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @kookma , please don't get me wrong. My intention is to make it possible for other themes to adapt the resizer. I will just have to think about it for a while
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the clarification! So, some default core themes will support the sidebar resizer.
All default core themes support the resizer at the moment.
I'm thinking about other themes that have the sidebar at the left for example. Those themes would need to set a specific config tiddler to yes and we could make the resizer adapt to it.
But I believe themes must use the metrics of the currently selected theme, otherwise this isn't possible.
Please ask if you have any questions
I've made the sidebar resizer work for |
This now adds an option to show the sidebar on the left, it doesn't do so anymore by default if |
This also adds some sensible adjustments for |
I've fixed the story-river not showing correctly when the sidebar is hidden |
This PR uses the same mechanism as #8644 but changes the
$:/themes/tiddlywiki/vanilla/metrics/...
tiddlers directly.Note that in fixed-fluid mode thestory-river
actually changes its width but thetiddlerwidth
remains fixed width as there was no discussion yet how we handle this. I just made the tiddlers adapt to the story-river if the story-river-width goes below the tiddlerwidth.There are some design questions:
I haven't yet added the ControlPanel configurations used for storyminwidth and sidebarminwidth.This PR is just for completeness, I will update it so that we can compare with other possible solutions.
In the meantime this PR has been updated quite a bit, I've put a current build here:
https://sidebar-resizer-config.tiddlyhost.com/