mirror of
https://github.com/nasa/openmct.git
synced 2024-12-20 13:43:09 +00:00
Merge remote-tracking branch 'origin/open747' into open-master
This commit is contained in:
commit
19bcfef123
@ -1,8 +1,10 @@
|
|||||||
<div content="jquery-wrapper" class="abs holder-all browse-mode">
|
<div content="jquery-wrapper" class="abs holder-all browse-mode">
|
||||||
<mct-include key="'topbar-browse'"></mct-include>
|
<mct-include key="'topbar-browse'"></mct-include>
|
||||||
<div class="holder browse-area outline abs" ng-controller="BrowseController">
|
<div class="holder browse-area outline abs" ng-controller="BrowseController">
|
||||||
<div class='split-layout vertical contents abs'>
|
<div class='split-layout vertical contents abs'
|
||||||
<div class='split-pane-component treeview pane' style="width: 200px;">
|
ng-controller="SplitPaneController as splitter">
|
||||||
|
<div class='split-pane-component treeview pane'
|
||||||
|
ng-style="{ width: splitter.state() + 'px'}">
|
||||||
<mct-representation key="'create-button'" mct-object="navigatedObject">
|
<mct-representation key="'create-button'" mct-object="navigatedObject">
|
||||||
</mct-representation>
|
</mct-representation>
|
||||||
<div class='holder tree-holder abs'>
|
<div class='holder tree-holder abs'>
|
||||||
@ -12,8 +14,12 @@
|
|||||||
</mct-representation>
|
</mct-representation>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="splitter" style="left: 200px"></div>
|
<div class="splitter"
|
||||||
<div class='split-pane-component items pane' style="right:0; left:200px;">
|
ng-style="{ left: splitter.state() + 'px'}"
|
||||||
|
mct-drag-down="splitter.startMove()"
|
||||||
|
mct-drag="splitter.move(delta[0])"></div>
|
||||||
|
<div class='split-pane-component items pane'
|
||||||
|
ng-style="{ left: splitter.state() + 'px', right: '0px' }">
|
||||||
<div class='holder abs' id='content-area'>
|
<div class='holder abs' id='content-area'>
|
||||||
<mct-representation mct-object="navigatedObject" key="'browse-object'">
|
<mct-representation mct-object="navigatedObject" key="'browse-object'">
|
||||||
</mct-representation>
|
</mct-representation>
|
||||||
|
@ -84,6 +84,10 @@
|
|||||||
"key": "GetterSetterController",
|
"key": "GetterSetterController",
|
||||||
"implementation": "controllers/GetterSetterController.js",
|
"implementation": "controllers/GetterSetterController.js",
|
||||||
"depends": [ "$scope" ]
|
"depends": [ "$scope" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "SplitPaneController",
|
||||||
|
"implementation": "controllers/SplitPaneController.js"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"directives": [
|
"directives": [
|
||||||
|
@ -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,54 @@
|
|||||||
|
/*global define*/
|
||||||
|
|
||||||
|
define(
|
||||||
|
[],
|
||||||
|
function () {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller for the splitter in Browse mode. Current implementation
|
||||||
|
* uses many hard-coded constants; this could be generalized.
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
function SplitPaneController() {
|
||||||
|
var minimum = 120,
|
||||||
|
maximum = 600,
|
||||||
|
current = 200,
|
||||||
|
start = 200;
|
||||||
|
|
||||||
|
return {
|
||||||
|
/**
|
||||||
|
* Get the current position of the splitter, in pixels
|
||||||
|
* from the left edge.
|
||||||
|
* @returns {number} position of the splitter, in pixels
|
||||||
|
*/
|
||||||
|
state: function () {
|
||||||
|
return current;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Begin moving the splitter; this will note the splitter's
|
||||||
|
* current position, which is necessary for correct
|
||||||
|
* interpretation of deltas provided by mct-drag.
|
||||||
|
*/
|
||||||
|
startMove: function () {
|
||||||
|
start = current;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Move the splitter a number of pixels to the right
|
||||||
|
* (negative numbers move the splitter to the left.)
|
||||||
|
* This movement is relative to the position of the
|
||||||
|
* splitter when startMove was last invoked.
|
||||||
|
* @param {number} delta number of pixels to move
|
||||||
|
*/
|
||||||
|
move: function (delta) {
|
||||||
|
current = Math.min(
|
||||||
|
maximum,
|
||||||
|
Math.max(minimum, start + delta)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return SplitPaneController;
|
||||||
|
}
|
||||||
|
);
|
@ -0,0 +1,46 @@
|
|||||||
|
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
|
||||||
|
|
||||||
|
define(
|
||||||
|
["../../src/controllers/SplitPaneController"],
|
||||||
|
function (SplitPaneController) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
describe("The split pane controller", function () {
|
||||||
|
var controller;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
controller = new SplitPaneController();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("has an initial position", function () {
|
||||||
|
expect(controller.state() > 0).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("can be moved", function () {
|
||||||
|
var initialState = controller.state();
|
||||||
|
controller.startMove();
|
||||||
|
controller.move(50);
|
||||||
|
expect(controller.state()).toEqual(initialState + 50);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("clamps its position", function () {
|
||||||
|
var initialState = controller.state();
|
||||||
|
controller.startMove();
|
||||||
|
// Move some really extreme number
|
||||||
|
controller.move(-100000);
|
||||||
|
// Shouldn't have moved below 0...
|
||||||
|
expect(controller.state() > 0).toBeTruthy();
|
||||||
|
// ...but should have moved left somewhere
|
||||||
|
expect(controller.state() < initialState).toBeTruthy();
|
||||||
|
|
||||||
|
// Then do the same to the right
|
||||||
|
controller.move(100000);
|
||||||
|
// Shouldn't have moved below 0...
|
||||||
|
expect(controller.state() < 100000).toBeTruthy();
|
||||||
|
// ...but should have moved left somewhere
|
||||||
|
expect(controller.state() > initialState).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
@ -4,6 +4,7 @@
|
|||||||
"controllers/ClickAwayController",
|
"controllers/ClickAwayController",
|
||||||
"controllers/ContextMenuController",
|
"controllers/ContextMenuController",
|
||||||
"controllers/GetterSetterController",
|
"controllers/GetterSetterController",
|
||||||
|
"controllers/SplitPaneController",
|
||||||
"controllers/ToggleController",
|
"controllers/ToggleController",
|
||||||
"controllers/TreeNodeController",
|
"controllers/TreeNodeController",
|
||||||
"controllers/ViewSwitcherController",
|
"controllers/ViewSwitcherController",
|
||||||
|
Loading…
Reference in New Issue
Block a user