[Inspector] Simplify splitter communication

This commit is contained in:
Victor Woeltjen 2015-11-04 10:51:58 -08:00
parent f7839b758d
commit 1c4a4e475b
2 changed files with 9 additions and 12 deletions

View File

@ -178,14 +178,10 @@ define(
return position;
}
// Dynamically apply a CSS class to elements when the user is actively resizing
function splitterState(state) {
var
children = $element.children(),
i;
for (i = 0; i < children.length; i++) {
children.eq(i).toggleClass('resizing');
}
// Dynamically apply a CSS class to elements when the user
// is actively resizing
function toggleClass(classToToggle) {
$element.children().toggleClass(classToToggle);
}
// Make sure anchor parameter is something we know
@ -218,7 +214,7 @@ define(
// Interface exposed by controller, for mct-splitter to user
return {
position: getSetPosition,
action: splitterState,
toggleClass: toggleClass,
anchor: function () {
return anchor;
}

View File

@ -54,7 +54,7 @@ define(
startMove: function () {
var splitter = element[0];
initialPosition = mctSplitPane.position();
mctSplitPane.action('startMove');
mctSplitPane.toggleClass('resizing');
},
// Handle user changes to splitter position
move: function (delta) {
@ -66,9 +66,10 @@ define(
// Update the position of this splitter
mctSplitPane.position(initialPosition + pixelDelta);
},
// Grab the event when the user is done moving the splitter and pass it on
// Grab the event when the user is done moving
// the splitter and pass it on
endMove: function() {
mctSplitPane.action('endMove');
mctSplitPane.toggleClass('resizing');
}
};
}