|
|
@ -124,6 +124,9 @@ void SurfaceManagerGui::mousePressed(ofMouseEventArgs& args) { |
|
|
|
if (!bSurfaceSelected) { |
|
|
|
for (int i = surfaceManager->size() - 1; i >= 0; i--) { |
|
|
|
if (surfaceManager->getSurface(i)->hitTest(ofVec2f(args.x, args.y))) { |
|
|
|
|
|
|
|
// TODO: Do not repeat this command if attempting to select an
|
|
|
|
// already selected surface.
|
|
|
|
_commandManager->exec(new SelectSurfaceCommand( |
|
|
|
surfaceManager, |
|
|
|
surfaceManager->getSurface(i), |
|
|
@ -140,6 +143,7 @@ void SurfaceManagerGui::mousePressed(ofMouseEventArgs& args) { |
|
|
|
clickPosition = ofVec2f(args.x, args.y); |
|
|
|
startDrag(); |
|
|
|
|
|
|
|
// TODO: Undo this command if surface not moved on mouse release
|
|
|
|
_commandManager->exec( |
|
|
|
new MoveSurfaceCommand( |
|
|
|
surfaceManager->getSelectedSurface(), |
|
|
@ -159,6 +163,12 @@ void SurfaceManagerGui::mouseReleased(ofMouseEventArgs& args) { |
|
|
|
stopDrag(); |
|
|
|
projectionEditor.stopDragJoints(); |
|
|
|
textureEditor.stopDragJoints(); |
|
|
|
|
|
|
|
// Check if surface has moved
|
|
|
|
if (!surfaceManager->getSelectedSurface()->getMoved()) { |
|
|
|
_commandManager->undo(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void SurfaceManagerGui::mouseDragged(ofMouseEventArgs& args) { |
|
|
@ -233,9 +243,7 @@ void SurfaceManagerGui::setMode(int newGuiMode) { |
|
|
|
|
|
|
|
void SurfaceManagerGui::drawSelectedSurfaceHighlight() { |
|
|
|
if (surfaceManager->getSelectedSurface() == NULL) return; |
|
|
|
|
|
|
|
ofPolyline line = surfaceManager->getSelectedSurface()->getHitArea(); |
|
|
|
|
|
|
|
ofPushStyle(); |
|
|
|
ofSetLineWidth(1); |
|
|
|
ofSetColor(255, 255, 255, 255); |
|
|
@ -245,9 +253,7 @@ void SurfaceManagerGui::drawSelectedSurfaceHighlight() { |
|
|
|
|
|
|
|
void SurfaceManagerGui::drawSelectedSurfaceTextureHighlight() { |
|
|
|
if (surfaceManager->getSelectedSurface() == NULL) return; |
|
|
|
|
|
|
|
ofPolyline line = surfaceManager->getSelectedSurface()->getTextureHitArea(); |
|
|
|
|
|
|
|
ofPushStyle(); |
|
|
|
ofSetLineWidth(1); |
|
|
|
ofSetColor(255, 255, 0, 255); |
|
|
|