1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-26 08:56:52 +00:00

update for clamped edgecases

This commit is contained in:
BurningTreeC 2024-10-09 05:03:21 +02:00
parent c092912df7
commit 8637f16e2d
3 changed files with 14 additions and 11 deletions

View File

@ -60,7 +60,7 @@ title: $:/core/macros/sidebar-resizer
<$action-deletetiddler $tiddler="$:/state/sidebar/resizing"/> <$action-deletetiddler $tiddler="$:/state/sidebar/resizing"/>
\end \end
\procedure set-storyleft-storyright-actions() \procedure set-storywidth-storyright-actions()
<$let <$let
storyRightStart={{{ [convert.to.pixels{$:/state/sidebar/resizing!!start-story-right}] }}} storyRightStart={{{ [convert.to.pixels{$:/state/sidebar/resizing!!start-story-right}] }}}
storyWidthStart={{{ [convert.to.pixels{$:/state/sidebar/resizing!!start-story-width}] }}} storyWidthStart={{{ [convert.to.pixels{$:/state/sidebar/resizing!!start-story-width}] }}}
@ -73,13 +73,16 @@ title: $:/core/macros/sidebar-resizer
sidebarMinWidth={{{ [convert.to.pixels{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}] }}} sidebarMinWidth={{{ [convert.to.pixels{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}] }}}
storyRiverLimit={{{ [<widgetNodeWidth>subtract<sidebarMinWidth>] }}} storyRiverLimit={{{ [<widgetNodeWidth>subtract<sidebarMinWidth>] }}}
storyMaxWidth={{{ [<storyRiverLimit>subtract<storyLeft>] }}} storyMaxWidth={{{ [<storyRiverLimit>subtract<storyLeft>] }}}
clampedDiff={{{ [<storyWidthStart>add<storyLeft>add<sidebarMinWidth>subtract<widgetNodeWidth>compare:number:gt[0]] ~0 }}}
tiddlerWidthMetric={{$:/state/sidebar/resizing!!tiddler-width-metric}} tiddlerWidthMetric={{$:/state/sidebar/resizing!!tiddler-width-metric}}
tiddlerWidthStart={{$:/state/sidebar/resizing!!start-tiddler-width}} tiddlerWidthStart={{$:/state/sidebar/resizing!!start-tiddler-width}}
tiddlerWidthStartPixels={{{ [<tiddlerWidthMetric>match[%]then<tiddlerWidthStart>multiply<innerStoryWidthStart>divide[100]] ~[convert.to.pixels<tiddlerWidthStart>] }}} tiddlerWidthStartPixels={{{ [<tiddlerWidthMetric>match[%]then<tiddlerWidthStart>multiply<innerStoryWidthStart>divide[100]] ~[convert.to.pixels<tiddlerWidthStart>] }}}
tiddlerWidth={{{ [<tiddlerWidthStartPixels>add<dragDiff>] }}} tiddlerWidth={{{ [<tiddlerWidthStartPixels>add<dragDiff>] }}}
tiddlerWidthDiff={{{ [<storyWidth>subtract<tiddlerWidth>] }}} tiddlerWidthDiff={{{ [<storyWidth>subtract<tiddlerWidth>] }}}
tiddlerMinWidth={{{ [<tiddlerWidthMetric>match[%]then<tiddlerWidth>] ~[<storyMinWidth>subtract<tiddlerWidthDiff>] }}} tiddlerMinWidth={{{ [<tiddlerWidthMetric>match[%]then<tiddlerWidth>] ~[<storyMinWidth>subtract<tiddlerWidthDiff>] }}}
tiddlerMaxWidth={{{ [<tiddlerWidthMetric>match[%]then<tiddlerWidth>] ~[<storyMaxWidth>subtract<tiddlerWidthDiff>] }}}> tiddlerMaxWidth={{{ [<tiddlerWidthMetric>match[%]then<tiddlerWidth>] ~[<storyMaxWidth>subtract<tiddlerWidthDiff>] }}}
storyWidth={{{ [<storyWidth>subtract<clampedDiff>] }}}
storyRiverWidth={{{ [<storyRiverWidth>subtract<clampedDiff>] }}}>
<$let <$let
storyWidthMetric={{$:/state/sidebar/resizing!!story-width-metric}} storyWidthMetric={{$:/state/sidebar/resizing!!story-width-metric}}
@ -139,9 +142,9 @@ title: $:/core/macros/sidebar-resizer
sidebarMinWidth={{{ [convert.to.pixels{$:/themes/tiddlywiki/centralised/metrics/sidebarminwidth}] }}} sidebarMinWidth={{{ [convert.to.pixels{$:/themes/tiddlywiki/centralised/metrics/sidebarminwidth}] }}}
storyMaxWidth={{{ [<widgetNodeWidth>subtract<sidebarMinWidth>subtract<sidebarMinWidth>] }}} storyMaxWidth={{{ [<widgetNodeWidth>subtract<sidebarMinWidth>subtract<sidebarMinWidth>] }}}
dragDiffMultiplied={{{ [<dragDiff>multiply[2]] }}} dragDiffMultiplied={{{ [<dragDiff>multiply[2]] }}}
storyWidthClamped={{{ [<storyWidthStart>add<sidebarMinWidth>add<sidebarMinWidth>subtract<widgetNodeWidth>] }}} storyWidthClamped={{{ [<storyWidthStart>add<sidebarMinWidth>add<sidebarMinWidth>subtract<widgetNodeWidth>compare:number:gt[0]] ~0 }}}
storyWidth={{{ [<storyWidthStart>add<dragDiffMultiplied>] }}} storyWidth={{{ [<storyWidthStart>add<dragDiffMultiplied>] }}}
storyWidth={{{ [<storyWidthClamped>compare:number:gt[0]then<storyWidth>subtract<storyWidthClamped>] ~[<storyWidth>] }}}> storyWidth={{{ [<storyWidth>subtract<storyWidthClamped>] }}}>
<$let <$let
storyWidthMetric={{$:/state/sidebar/resizing!!centralised-story-width-metric}} storyWidthMetric={{$:/state/sidebar/resizing!!centralised-story-width-metric}}
@ -160,7 +163,7 @@ title: $:/core/macros/sidebar-resizer
<%if [[$:/state/sidebar/resizing]!is[missing]] %> <%if [[$:/state/sidebar/resizing]!is[missing]] %>
<$let widgetNodeWidth={{$:/state/sidebar/resizing!!widget-node-width}} dragDiff={{{ [<event-fromcatcher-posx>subtract{$:/state/sidebar/resizing!!start-posx}] }}} startStoryRight={{{ [convert.to.pixels{$:/state/sidebar/resizing!!start-story-right}] }}} storyRiverWidth={{{ [<startStoryRight>add<dragDiff>] }}} startSidebarWidth={{{ [convert.to.pixels{$:/state/sidebar/resizing!!start-sidebar-width}] }}} sidebarWidth={{{ [<startSidebarWidth>subtract<dragDiff>] }}}> <$let widgetNodeWidth={{$:/state/sidebar/resizing!!widget-node-width}} dragDiff={{{ [<event-fromcatcher-posx>subtract{$:/state/sidebar/resizing!!start-posx}] }}} startStoryRight={{{ [convert.to.pixels{$:/state/sidebar/resizing!!start-story-right}] }}} storyRiverWidth={{{ [<startStoryRight>add<dragDiff>] }}} startSidebarWidth={{{ [convert.to.pixels{$:/state/sidebar/resizing!!start-sidebar-width}] }}} sidebarWidth={{{ [<startSidebarWidth>subtract<dragDiff>] }}}>
<%if [{$:/themes/tiddlywiki/vanilla/options/sidebarlayout}match[fixed-fluid]then{$:/theme}!match[$:/themes/tiddlywiki/centralised]] %> <%if [{$:/themes/tiddlywiki/vanilla/options/sidebarlayout}match[fixed-fluid]then{$:/theme}!match[$:/themes/tiddlywiki/centralised]] %>
<<set-storyleft-storyright-actions>> <<set-storywidth-storyright-actions>>
<%elseif [{$:/themes/tiddlywiki/vanilla/options/sidebarlayout}match[fluid-fixed]then{$:/theme}!match[$:/themes/tiddlywiki/centralised]] %> <%elseif [{$:/themes/tiddlywiki/vanilla/options/sidebarlayout}match[fluid-fixed]then{$:/theme}!match[$:/themes/tiddlywiki/centralised]] %>
<<set-sidebarwidth-actions>> <<set-sidebarwidth-actions>>
<%elseif [{$:/theme}match[$:/themes/tiddlywiki/centralised]] %> <%elseif [{$:/theme}match[$:/themes/tiddlywiki/centralised]] %>

View File

@ -1027,7 +1027,7 @@ button.tc-btn-invisible.tc-remove-tag-button {
.tc-sidebar-scrollable { .tc-sidebar-scrollable {
position: fixed; position: fixed;
top: {{$:/themes/tiddlywiki/vanilla/metrics/storytop}}; top: {{$:/themes/tiddlywiki/vanilla/metrics/storytop}};
left: min(calc(100% - {{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}}),{{$:/themes/tiddlywiki/vanilla/metrics/storyright}}); left: clamp(calc({{$:/themes/tiddlywiki/vanilla/metrics/storyleft}} + {{$:/themes/tiddlywiki/vanilla/metrics/storyminwidth}}),{{$:/themes/tiddlywiki/vanilla/metrics/storyright}},calc(100% - {{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}}));
bottom: 0; bottom: 0;
right: 0; right: 0;
overflow-y: auto; overflow-y: auto;
@ -1039,14 +1039,14 @@ button.tc-btn-invisible.tc-remove-tag-button {
html[dir="rtl"] .tc-sidebar-scrollable { html[dir="rtl"] .tc-sidebar-scrollable {
left: auto; left: auto;
right: min(calc(100% - {{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}}),{{$:/themes/tiddlywiki/vanilla/metrics/storyright}}); right: clamp(calc({{$:/themes/tiddlywiki/vanilla/metrics/storyleft}} + {{$:/themes/tiddlywiki/vanilla/metrics/storyminwidth}}),{{$:/themes/tiddlywiki/vanilla/metrics/storyright}},calc(100% - {{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}}));
} }
.tc-story-river { .tc-story-river {
position: relative; position: relative;
left: max(0px,{{$:/themes/tiddlywiki/vanilla/metrics/storyleft}}); left: max(0px,{{$:/themes/tiddlywiki/vanilla/metrics/storyleft}});
top: {{$:/themes/tiddlywiki/vanilla/metrics/storytop}}; top: {{$:/themes/tiddlywiki/vanilla/metrics/storytop}};
width: max({{$:/themes/tiddlywiki/vanilla/metrics/storyminwidth}},{{$:/themes/tiddlywiki/vanilla/metrics/storywidth}}); width: clamp({{$:/themes/tiddlywiki/vanilla/metrics/storyminwidth}},{{$:/themes/tiddlywiki/vanilla/metrics/storywidth}},calc(100% - {{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}}));
padding: 42px 42px 42px 42px; padding: 42px 42px 42px 42px;
} }
@ -1481,7 +1481,7 @@ html body.tc-body.tc-single-tiddler-window {
width: auto; width: auto;
left: 0; left: 0;
margin-left: max(0px,{{$:/themes/tiddlywiki/vanilla/metrics/storyleft}}); margin-left: max(0px,{{$:/themes/tiddlywiki/vanilla/metrics/storyleft}});
margin-right: {{$:/themes/tiddlywiki/vanilla/metrics/sidebarwidth}}; margin-right: max({{$:/themes/tiddlywiki/vanilla/metrics/sidebarwidth}},{{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}});
} }
.tc-tiddler-frame { .tc-tiddler-frame {
@ -1492,7 +1492,7 @@ html body.tc-body.tc-single-tiddler-window {
left: auto; left: auto;
bottom: 0; bottom: 0;
right: 0; right: 0;
width: max({{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}},{{$:/themes/tiddlywiki/vanilla/metrics/sidebarwidth}}); width: clamp({{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}},{{$:/themes/tiddlywiki/vanilla/metrics/sidebarwidth}},(100% - {{$:/themes/tiddlywiki/vanilla/metrics/storyminwidth}} - {{$:/themes/tiddlywiki/vanilla/metrics/storyleft}}));
} }
body.tc-body .tc-page-container.tc-page-view-zoomin .tc-tiddler-frame { body.tc-body .tc-page-container.tc-page-view-zoomin .tc-tiddler-frame {

View File

@ -83,7 +83,7 @@ code-body: yes
<%if [{$:/themes/tiddlywiki/vanilla/options/sidebarlayout}match[fixed-fluid]then{$:/theme}!match[$:/themes/tiddlywiki/centralised]] %> <%if [{$:/themes/tiddlywiki/vanilla/options/sidebarlayout}match[fixed-fluid]then{$:/theme}!match[$:/themes/tiddlywiki/centralised]] %>
.tc-sidebar-resizer { .tc-sidebar-resizer {
left: clamp(calc({{$:/themes/tiddlywiki/vanilla/metrics/storywidth}} - 28px),max(calc({{$:/themes/tiddlywiki/vanilla/metrics/storyleft}} + {{$:/themes/tiddlywiki/vanilla/metrics/storywidth}} - 28px),calc({{$:/themes/tiddlywiki/vanilla/metrics/storyright}} - 28px)),max(calc(100% - {{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}} - 28px + ({{$:/themes/tiddlywiki/vanilla/metrics/storyleft}} + {{$:/themes/tiddlywiki/vanilla/metrics/storywidth}} - {{$:/themes/tiddlywiki/vanilla/metrics/storyright}})),calc(100% - {{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}} - 28px))); left: clamp(calc({{$:/themes/tiddlywiki/vanilla/metrics/storyleft}} + {{$:/themes/tiddlywiki/vanilla/metrics/storyminwidth}} - 28px),clamp(calc({{$:/themes/tiddlywiki/vanilla/metrics/storywidth}} - 28px),max(calc({{$:/themes/tiddlywiki/vanilla/metrics/storyleft}} + {{$:/themes/tiddlywiki/vanilla/metrics/storywidth}} - 28px),calc({{$:/themes/tiddlywiki/vanilla/metrics/storyright}} - 28px)),max(calc(100% - {{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}} - 28px + ({{$:/themes/tiddlywiki/vanilla/metrics/storyleft}} + {{$:/themes/tiddlywiki/vanilla/metrics/storywidth}} - {{$:/themes/tiddlywiki/vanilla/metrics/storyright}})),calc(100% - {{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}} - 28px))),calc(100% - {{$:/themes/tiddlywiki/vanilla/metrics/sidebarminwidth}} - 28px));
} }
<%elseif [{$:/themes/tiddlywiki/vanilla/options/sidebarlayout}match[fluid-fixed]then{$:/theme}!match[$:/themes/tiddlywiki/centralised]] %> <%elseif [{$:/themes/tiddlywiki/vanilla/options/sidebarlayout}match[fluid-fixed]then{$:/theme}!match[$:/themes/tiddlywiki/centralised]] %>