Merge remote-tracking branch 'github-open/open53' into open-master

This commit is contained in:
Pete Richards
2015-09-14 11:00:56 -07:00
3 changed files with 16 additions and 8 deletions

View File

@@ -135,7 +135,7 @@
{ {
"key": "mctSplitPane", "key": "mctSplitPane",
"implementation": "directives/MCTSplitPane.js", "implementation": "directives/MCTSplitPane.js",
"depends": [ "$parse", "$log" ] "depends": [ "$parse", "$log", "$interval" ]
}, },
{ {
"key": "mctSplitter", "key": "mctSplitter",

View File

@@ -28,6 +28,7 @@ define(
// Pixel width to allocate for the splitter itself // Pixel width to allocate for the splitter itself
var DEFAULT_ANCHOR = 'left', var DEFAULT_ANCHOR = 'left',
POLLING_INTERVAL = 15, // milliseconds
CHILDREN_WARNING_MESSAGE = [ CHILDREN_WARNING_MESSAGE = [
"Invalid mct-split-pane contents.", "Invalid mct-split-pane contents.",
"This element should contain exactly three", "This element should contain exactly three",
@@ -94,7 +95,7 @@ define(
* @memberof platform/commonUI/general * @memberof platform/commonUI/general
* @constructor * @constructor
*/ */
function MCTSplitPane($parse, $log) { function MCTSplitPane($parse, $log, $interval) {
var anchors = { var anchors = {
left: true, left: true,
right: true, right: true,
@@ -105,6 +106,7 @@ define(
function controller($scope, $element, $attrs) { function controller($scope, $element, $attrs) {
var anchorKey = $attrs.anchor || DEFAULT_ANCHOR, var anchorKey = $attrs.anchor || DEFAULT_ANCHOR,
anchor, anchor,
activeInterval,
positionParsed = $parse($attrs.position), positionParsed = $parse($attrs.position),
position; // Start undefined, until explicitly set position; // Start undefined, until explicitly set
@@ -162,14 +164,14 @@ define(
// Getter-setter for the pixel offset of the splitter, // Getter-setter for the pixel offset of the splitter,
// relative to the current edge. // relative to the current edge.
function getSetPosition(value) { function getSetPosition(value) {
var min, max; var min, max, prior = position;
if (typeof value === 'number') { if (typeof value === 'number') {
position = value; position = value;
enforceExtrema(); enforceExtrema();
updateElementPositions(); updateElementPositions();
// Pass change up so this state can be shared // Pass change up so this state can be shared
if (positionParsed.assign) { if (positionParsed.assign && position !== prior) {
positionParsed.assign($scope, position); positionParsed.assign($scope, position);
} }
} }
@@ -193,6 +195,16 @@ define(
$element.children().eq(anchor.reversed ? 2 : 0)[0] $element.children().eq(anchor.reversed ? 2 : 0)[0]
)); ));
// And poll for position changes enforced by styles
activeInterval = $interval(function () {
getSetPosition(getSetPosition());
}, POLLING_INTERVAL, false);
// ...and stop polling when we're destroyed.
$scope.$on('$destroy', function () {
$interval.cancel(activeInterval);
});
// Interface exposed by controller, for mct-splitter to user // Interface exposed by controller, for mct-splitter to user
return { return {
position: getSetPosition, position: getSetPosition,

View File

@@ -48,10 +48,6 @@ define(
element.addClass("splitter"); element.addClass("splitter");
// Now that we have the above class, the splitter width
// will have changed, so trigger a positioning update.
mctSplitPane.position(mctSplitPane.position());
scope.splitter = { scope.splitter = {
// Begin moving this splitter // Begin moving this splitter
startMove: function () { startMove: function () {