Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Left Menu
</FluentMultiSplitterPane>
<FluentMultiSplitterPane Size="50%">
<FluentMultiSplitter OnResize="@OnResizeHandler" Orientation="Orientation.Vertical">
<FluentMultiSplitter OnResize="@OnResizeHandler" OnExpand="@OnCollapseExpand" OnCollapse="@OnCollapseExpand" Orientation="Orientation.Vertical">
<FluentMultiSplitterPane Collapsible="true">
Main Content
</FluentMultiSplitterPane>
Expand All @@ -23,4 +23,10 @@
{
DemoLogger.WriteLine($"Pane {e.PaneIndex} Resize (New size {e.NewSize})");
}

void OnCollapseExpand(FluentMultiSplitterEventArgs e)
{
bool willCollapse = !e.Pane.Collapsed;
DemoLogger.WriteLine($"Pane {e.PaneIndex} {(willCollapse ? "collapsed" : "expanded")}");
}
}
23 changes: 16 additions & 7 deletions src/Core/Components/Splitter/FluentMultiSplitter.razor.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,32 @@ export function startSplitterResize(
pane.style.flexBasis.includes('%') &&
paneNext.style.flexBasis.includes('%')) {

splitter.invokeMethodAsync(
'FluentMultiSplitter.OnPaneResizedAsync',
parseInt(pane.getAttribute('data-index')),
parseFloat(pane.style.flexBasis),
paneNext ? parseInt(paneNext.getAttribute('data-index')) : null,
paneNext ? parseFloat(paneNext.style.flexBasis) : null
);
if (document.splitterData[el].moved === true) {
splitter.invokeMethodAsync(
'FluentMultiSplitter.OnPaneResizedAsync',
parseInt(pane.getAttribute('data-index')),
parseFloat(pane.style.flexBasis),
paneNext ? parseInt(paneNext.getAttribute('data-index')) : null,
paneNext ? parseFloat(paneNext.style.flexBasis) : null
);
}

document.removeEventListener('mousemove', document.splitterData[el].mouseMoveHandler);
document.removeEventListener('mouseup', document.splitterData[el].mouseUpHandler);
document.removeEventListener('touchmove', document.splitterData[el].touchMoveHandler);
document.removeEventListener('touchend', document.splitterData[el].mouseUpHandler);
document.splitterData[el] = null;
}

if (document.splitterData[el]) {
document.splitterData[el].moved = false;
}
},
mouseMoveHandler: function (e) {
if (document.splitterData[el]) {

document.splitterData[el].moved = true;

var spacePerc = document.splitterData[el].panePerc + document.splitterData[el].paneNextPerc;
var spaceLength = document.splitterData[el].paneLength + document.splitterData[el].paneNextLength;

Expand Down