[Browse] Begin implementing splitter movement
Begin implementing moveable splitter, WTD-747.
This commit is contained in:
@@ -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": [
|
||||
|
||||
@@ -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>
|
||||
@@ -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;
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user