Browse Source

Do not repeat SelectSurfaceCommand if surface already selected

master
Krisjanis Rijnieks 10 years ago
parent
commit
746742fac0
  1. 25
      src/Surfaces/SurfaceManagerGui.cpp

25
src/Surfaces/SurfaceManagerGui.cpp

@ -125,12 +125,15 @@ namespace ofx {
for (int i = surfaceManager->size() - 1; i >= 0; i--) { for (int i = surfaceManager->size() - 1; i >= 0; i--) {
if (surfaceManager->getSurface(i)->hitTest(ofVec2f(args.x, args.y))) { if (surfaceManager->getSurface(i)->hitTest(ofVec2f(args.x, args.y))) {
// TODO: Do not repeat this command if attempting to select an // Do not repeat this command if attempting to select an
// already selected surface. // already selected surface.
_commandManager->exec(new SelectSurfaceCommand( if (surfaceManager->getSelectedSurface() != surfaceManager->getSurface(i)){
surfaceManager, _commandManager->exec(new SelectSurfaceCommand(
surfaceManager->getSurface(i), surfaceManager,
&projectionEditor)); surfaceManager->getSurface(i),
&projectionEditor));
}
bSurfaceSelected = true; bSurfaceSelected = true;
break; break;
} }
@ -138,16 +141,16 @@ namespace ofx {
} }
if (bSurfaceSelected && hitJoint == NULL) { if (bSurfaceSelected && hitJoint == NULL) {
// if not hitting the joints, start drag only if we have a selected
// surface // if not hitting the joints, start drag only if
// we have a selected surface
clickPosition = ofVec2f(args.x, args.y); clickPosition = ofVec2f(args.x, args.y);
startDrag(); startDrag();
// TODO: Undo this command if surface not moved on mouse release
_commandManager->exec( _commandManager->exec(
new MoveSurfaceCommand( new MoveSurfaceCommand(
surfaceManager->getSelectedSurface(), surfaceManager->getSelectedSurface(),
&projectionEditor)); &projectionEditor));
} }
if (!bSurfaceSelected) { if (!bSurfaceSelected) {

Loading…
Cancel
Save