Browse Source

Do not repeat SelectSurfaceCommand if surface already selected

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

11
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.
if (surfaceManager->getSelectedSurface() != surfaceManager->getSurface(i)){
_commandManager->exec(new SelectSurfaceCommand( _commandManager->exec(new SelectSurfaceCommand(
surfaceManager, surfaceManager,
surfaceManager->getSurface(i), surfaceManager->getSurface(i),
&projectionEditor)); &projectionEditor));
}
bSurfaceSelected = true; bSurfaceSelected = true;
break; break;
} }
@ -138,12 +141,12 @@ 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(),

Loading…
Cancel
Save