Skip to content

Commit 052e72b

Browse files
committed
Don't call reposition() unless things have actually moved.
1 parent b6cb8b9 commit 052e72b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

app/directives/master.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@
146146
element.off( "mousemove.bnMaster" );
147147
element.off( "mouseup.bnMaster" );
148148

149+
// Check to see if the elements have moved at all. If they have not, then there
150+
// is nothing more that the master needs to do.
151+
if ( ! hasMoved( event.pageX, event.pageY ) ) {
152+
153+
return;
154+
155+
}
156+
149157
// Tell all the slaves to finalize positions.
150158
$scope.$apply(
151159
function() {
@@ -161,6 +169,17 @@
161169
}
162170

163171

172+
// I determine if the given coorindates indicate movement from the original position.
173+
function hasMoved( pageX, pageY ) {
174+
175+
return(
176+
( pageX !== initialPageX ) ||
177+
( pageY !== initialPageY )
178+
);
179+
180+
}
181+
182+
164183
// -- Define Link Variables. ---------------- //
165184

166185

0 commit comments

Comments
 (0)