[Browse] Begin implementing splitter movement

Begin implementing moveable splitter, WTD-747.
This commit is contained in:
Victor Woeltjen 2015-01-28 16:25:16 -08:00
parent d0de13ca62
commit 06b599ee37
4 changed files with 56 additions and 4 deletions

View File

@ -2,7 +2,7 @@
<mct-include key="'topbar-browse'"></mct-include>
<div class="holder browse-area outline abs" ng-controller="BrowseController">
<div class='split-layout vertical contents abs'>
<div class='split-pane-component treeview pane' style="width: 200px;">
<div class='split-pane-component treeview pane'>
<mct-representation key="'create-button'" mct-object="navigatedObject">
</mct-representation>
<div class='holder tree-holder abs'>
@ -12,13 +12,12 @@
</mct-representation>
</div>
</div>
<div class="splitter" style="left: 200px"></div>
<div class='split-pane-component items pane' style="right:0; left:200px;">
<mct-container key="splitter">
<div class='holder abs' id='content-area'>
<mct-representation mct-object="navigatedObject" key="'browse-object'">
</mct-representation>
</div>
</div>
</mct-container>
</div>
</div>
<mct-include key="'bottombar'"></mct-include>

View File

@ -84,6 +84,10 @@
"key": "GetterSetterController",
"implementation": "controllers/GetterSetterController.js",
"depends": [ "$scope" ]
},
{
"key": "SplitPaneController",
"implementation": "controllers/SplitPaneController.js"
}
],
"directives": [
@ -108,6 +112,10 @@
"key": "accordion",
"templateUrl": "templates/containers/accordion.html",
"attributes": [ "title" ]
},
{
"key": "splitter",
"templateUrl": "templates/containers/split-pane.html"
}
],
"representations": [

View File

@ -0,0 +1,9 @@
<span ng-controller="SplitPaneController as splitter">
<div class="splitter" ng-style="splitter.style()"
mct-drag="splitter.move(delta.x)">
</div>
<div class='split-pane-component items pane' style="right:0;"
ng-style="splitter.style()"
ng-transclude>
</div>
</span>

View File

@ -0,0 +1,36 @@
/*global define*/
define(
[],
function () {
"use strict";
function SplitPaneController() {
var minimum = 8,
maximum = 600,
current = 200,
style;
function updateStyle() {
style = { left: current + 'px' };
}
updateStyle();
return {
style: function () {
return style;
},
move: function (delta) {
current = Math.min(
maximum,
Math.max(minimum, current + delta)
);
updateStyle();
}
};
}
return SplitPaneController;
}
);