From 340375d0c0abd4349af33c7ab8717f95ebfb68c5 Mon Sep 17 00:00:00 2001 From: BurningTreeC Date: Fri, 1 Nov 2024 18:41:14 +0100 Subject: [PATCH] make fluid-fixed and fixed-fluid visually the same (storyminwidth and sidebarminwidth) --- core/wiki/macros/sidebar-resizer.tid | 20 ++++++++++++++----- themes/tiddlywiki/vanilla/base.tid | 7 ++++--- themes/tiddlywiki/vanilla/sidebar-resizer.tid | 4 ++-- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/core/wiki/macros/sidebar-resizer.tid b/core/wiki/macros/sidebar-resizer.tid index 4fef40afa..fa2e75ee2 100644 --- a/core/wiki/macros/sidebar-resizer.tid +++ b/core/wiki/macros/sidebar-resizer.tid @@ -143,7 +143,7 @@ title: $:/core/procedures/sidebar-resizer sidebarMinWidth={{{ [convert.to.pixels.locally] :map[] }}} storyLeftValue={{{ [!is[blank]get[text]] :else[] }}} storyLeft={{{ [convert.to.pixels.locally] }}} - clampedDiff={{{ [addaddsubtractcompare:number:gt[0]] ~0 }}} + clampedDiff={{{ [addaddsubtractcompare:number:gt[0]] :else[[0]] }}} storyWidthStart={{{ [subtract] }}} storyRightStart={{{ [subtract] }}} storyWidth={{{ [add] }}} @@ -155,7 +155,7 @@ title: $:/core/procedures/sidebar-resizer tiddlerWidthMetric={{{ [get[tiddler-width-metric]] }}} tiddlerWidthStart={{{ [get[start-tiddler-width]] }}} tiddlerWidthStartPixels={{{ [match[%]thenmultiplydivide[100]] :else[convert.to.pixels.locally] }}} - tiddlerWidthClampedDiff={{{ [addaddaddaddsubtractcompare:number:gt[0]] ~0 }}} + tiddlerWidthClampedDiff={{{ [addaddaddaddsubtractcompare:number:gt[0]] :else[[0]] }}} tiddlerWidth={{{ [addsubtract] }}} tiddlerWidthDiff={{{ [subtract] }}} tiddlerMinWidth={{{ [match[%]then] :else[subtract] }}} @@ -198,8 +198,18 @@ title: $:/core/procedures/sidebar-resizer :else[addsuffix] \end +\function get.fluid.padding() +[match[left]then] +:else[match[right]then] +:else[[0]] +\end + \procedure set-sidebarwidth-actions() <$let + storyPaddingLeftValue={{{ [!is[blank]is[tiddler]get[text]] :else[!is[blank]is[missing]then[0px]] :else[] }}} + storyPaddingLeft={{{ [convert.to.pixels.locally] }}} + storyPaddingRightValue={{{ [!is[blank]is[tiddler]get[text]] :else[!is[blank]is[missing]then[0px]] :else[] }}} + storyPaddingRight={{{ [convert.to.pixels.locally] }}} sidebarMinWidthValue={{{ [!is[blank]is[tiddler]get[text]] :else[!is[blank]is[missing]then] :else[] }}} sidebarWidthMetric={{{ [get[sidebar-width-metric]] }}} sidebarMinWidth={{{ [convert.to.pixels.locally] }}} @@ -207,8 +217,8 @@ title: $:/core/procedures/sidebar-resizer storyLeft={{{ [convert.to.pixels.locally] }}} storyMinWidthValue={{{ [!is[blank]is[tiddler]get[text]] :else[!is[blank]is[missing]then] :else[] }}} storyMinWidth={{{ [convert.to.pixels.locally] }}} - sidebarMaxWidth={{{ [subtractsubtract] }}} - clampedDiff={{{ [addaddsubtractcompare:number:gt[0]] ~0 }}} + sidebarMaxWidth={{{ [subtractsubtractadd] }}} + clampedDiff={{{ [addaddsubtractcompare:number:gt[0]] :else[[0]] }}} sliderWidth={{{ [convert.to.pixels.locally] }}} sidebarWidth={{{ [subtractsubtract] }}}> @@ -240,7 +250,7 @@ title: $:/core/procedures/sidebar-resizer sidebarMinWidth={{{ [convert.to.pixels.locally] }}} storyMaxWidth={{{ [subtractsubtract] }}} dragDiffMultiplied={{{ [multiply[2]] }}} - storyWidthClamped={{{ [addaddsubtractcompare:number:gt[0]] ~0 }}} + storyWidthClamped={{{ [addaddsubtractcompare:number:gt[0]] :else[[0]] }}} storyWidth={{{ [add] }}} storyWidth={{{ [subtract] }}}> diff --git a/themes/tiddlywiki/vanilla/base.tid b/themes/tiddlywiki/vanilla/base.tid index e28143439..4c00aa02a 100644 --- a/themes/tiddlywiki/vanilla/base.tid +++ b/themes/tiddlywiki/vanilla/base.tid @@ -1521,12 +1521,12 @@ html body.tc-body.tc-single-tiddler-window { width: auto; left: 0; margin-left: max(0px,{{$:/themes/tiddlywiki/vanilla/metrics/storyleft}}); - margin-right: clamp({{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}},<>,calc(100% - {{$:/themes/tiddlywiki/vanilla/metrics/storyleft}} - {{$:/themes/tiddlywiki/vanilla/metrics/storyminwidth}})); + margin-right: clamp({{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}},<>,calc(100% - {{$:/themes/tiddlywiki/vanilla/metrics/storyleft}} - {{$:/themes/tiddlywiki/vanilla/metrics/storyminwidth}} + <>)); } .tc-sidebar-left .tc-story-river { margin-right: max(0px,{{$:/themes/tiddlywiki/vanilla/metrics/storyleft}}); - margin-left: clamp({{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}},<>,calc(100% - {{$:/themes/tiddlywiki/vanilla/metrics/storyleft}} - {{$:/themes/tiddlywiki/vanilla/metrics/storyminwidth}})); + margin-left: clamp({{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}},<>,calc(100% - {{$:/themes/tiddlywiki/vanilla/metrics/storyleft}} - {{$:/themes/tiddlywiki/vanilla/metrics/storyminwidth}} + <>)); left: auto; width: auto; right: 0; @@ -1547,12 +1547,13 @@ html body.tc-body.tc-single-tiddler-window { left: auto; bottom: 0; right: 0; - width: clamp({{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}},<>,(100% - {{$:/themes/tiddlywiki/vanilla/metrics/storyminwidth}} - {{$:/themes/tiddlywiki/vanilla/metrics/storyleft}})); + width: clamp({{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}},<>,(100% - {{$:/themes/tiddlywiki/vanilla/metrics/storyminwidth}} - {{$:/themes/tiddlywiki/vanilla/metrics/storyleft}} + <>)); } .tc-sidebar-left .tc-sidebar-scrollable { left: 0; right: auto; + width: clamp({{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}},<>,(100% - {{$:/themes/tiddlywiki/vanilla/metrics/storyminwidth}} - {{$:/themes/tiddlywiki/vanilla/metrics/storyleft}} + <>)); } html[dir="rtl"] .tc-sidebar-left .tc-sidebar-scrollable { diff --git a/themes/tiddlywiki/vanilla/sidebar-resizer.tid b/themes/tiddlywiki/vanilla/sidebar-resizer.tid index a4bc3f571..c8d6225fd 100644 --- a/themes/tiddlywiki/vanilla/sidebar-resizer.tid +++ b/themes/tiddlywiki/vanilla/sidebar-resizer.tid @@ -121,12 +121,12 @@ code-body: yes <%if [match[yes]] %> .tc-sidebar-resizer.tc-main-sidebar-resizer { - left: clamp(calc(<> + <> + (<> / 3)),calc(100% - <> + (<> / 3)),calc(100% - <> + (<> / 3))); + left: clamp(calc(<> + <> - <> + (<> / 3)),calc(100% - <> + (<> / 3)),calc(100% - <> + (<> / 3))); } .tc-sidebar-left .tc-sidebar-resizer.tc-main-sidebar-resizer { left: auto; - right: clamp(calc(<> + <> + (<> / 3)),calc(100% - <> + (<> / 3)),calc(100% - <> + (<> / 3))); + right: clamp(calc(<> + <> - <> + (<> / 3)),calc(100% - <> + (<> / 3)),calc(100% - <> + (<> / 3))); } <% endif %>