mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-10 09:20:26 +00:00
Create sidebar-resizer.tid
This commit is contained in:
parent
ac8fa2cf00
commit
1e0d4b87fb
30
core/wiki/macros/sidebar-resizer.tid
Normal file
30
core/wiki/macros/sidebar-resizer.tid
Normal file
@ -0,0 +1,30 @@
|
||||
title: $:/core/macros/sidebar-resizer
|
||||
|
||||
\procedure sidebar-resizer-pointerdown-actions()
|
||||
<%if [[$:/state/sidebar/resizing]is[missing]then<event-mousebutton>match[left]then<modifier>match[normal]] %>
|
||||
<$let dragDiff=<<event-fromselected-posx>> dragWidth=<<tv-selectednode-width>> rightDiff={{{ [<dragWidth>subtract<dragDiff>] }}} storyRiverWidth={{{ [<event-fromcatcher-posx>subtract<dragDiff>subtract[14]] }}} sidebarWidth={{{ [<tv-widgetnode-width>subtract<event-fromcatcher-posx>subtract<dragDiff>subtract[14]] }}}>
|
||||
<%if [{$:/themes/tiddlywiki/vanilla/options/sidebarlayout}match[fixed-fluid]] %>
|
||||
<$action-setfield $tiddler="$:/themes/tiddlywiki/vanilla/metrics/storywidth" text={{{ [<storyRiverWidth>addsuffix[px]] }}}/>
|
||||
<$action-setfield $tiddler="$:/themes/tiddlywiki/vanilla/metrics/storyright" text={{{ [<event-fromcatcher-posx>add<rightDiff>add[6]addsuffix[px]] }}}/>
|
||||
<% else %>
|
||||
<$action-setfield $tiddler="$:/themes/tiddlywiki/vanilla/metrics/sidebarwidth" text={{{ [<sidebarWidth>addsuffix[px]] }}}/>
|
||||
<% endif %>
|
||||
<$action-setfield $tiddler="$:/state/sidebar/resizing" text="yes" drag-diff=<<dragDiff>> right-diff=<<rightDiff>>/>
|
||||
</$let>
|
||||
<% endif %>
|
||||
\end
|
||||
\procedure sidebar-resizer-pointercancel-actions()
|
||||
<$action-deletetiddler $tiddler="$:/state/sidebar/resizing"/>
|
||||
\end
|
||||
\procedure sidebar-resizer-pointermove-actions()
|
||||
<%if [[$:/state/sidebar/resizing]!is[missing]] %>
|
||||
<$let storyRiverWidth={{{ [<event-fromcatcher-posx>subtract{$:/state/sidebar/resizing!!drag-diff}subtract[14]] }}} sidebarWidth={{{ [<tv-widgetnode-width>subtract<event-fromcatcher-posx>subtract{$:/state/sidebar/resizing!!drag-diff}subtract[14]] }}}>
|
||||
<%if [{$:/themes/tiddlywiki/vanilla/options/sidebarlayout}match[fixed-fluid]] %>
|
||||
<$action-setfield $tiddler="$:/themes/tiddlywiki/vanilla/metrics/storywidth" text={{{ [<storyRiverWidth>addsuffix[px]] }}}/>
|
||||
<$action-setfield $tiddler="$:/themes/tiddlywiki/vanilla/metrics/storyright" text={{{ [<event-fromcatcher-posx>add{$:/state/sidebar/resizing!!right-diff}add[6]addsuffix[px]] }}}/>
|
||||
<% else %>
|
||||
<$action-setfield $tiddler="$:/themes/tiddlywiki/vanilla/metrics/sidebarwidth" text={{{ [<sidebarWidth>addsuffix[px]] }}}/>
|
||||
<% endif %>
|
||||
</$let>
|
||||
<% endif %>
|
||||
\end
|
Loading…
Reference in New Issue
Block a user