From 5b8b440c9f91a6893df65e1bd0d84ab7e9da860a Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Sun, 11 May 2014 23:18:41 +0200 Subject: [PATCH] Fix select overlaping projection areas --- example/src/ofApp.cpp | 1 + src/ofxSurfaceManager.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/example/src/ofApp.cpp b/example/src/ofApp.cpp index 558e1fe..2bd1709 100644 --- a/example/src/ofApp.cpp +++ b/example/src/ofApp.cpp @@ -6,6 +6,7 @@ void ofApp::setup() bShowInfo = false; surfaceManager.addSurface(); + surfaceManager.addSurface(); } void ofApp::update() diff --git a/src/ofxSurfaceManager.cpp b/src/ofxSurfaceManager.cpp index 80359ec..ad253f6 100644 --- a/src/ofxSurfaceManager.cpp +++ b/src/ofxSurfaceManager.cpp @@ -35,7 +35,7 @@ void ofxSurfaceManager::draw() { // Check GUI mode - we want to see the texture that we are editing // together with the actual surface being projection mapped. - for ( int i=0; i=0; i-- ) { bool bDrawTexture = false; if ( surfaceGuis[i]->isSelected() && surfaceGuis[i]->getMode() == ofxSurfaceGui::TEXTURE_MAPPING ) { @@ -70,12 +70,18 @@ void ofxSurfaceManager::mousePressed(int x, int y, int button) // check only if in projection mapping mode if ( surfaceGuis[i]->getMode() == ofxSurfaceGui::PROJECTION_MAPPING ) { if ( surfaceGuis[i]->hitTest(x, y) ) { + unselectAllSurfaces(); selectSurface(i); bSurfaceSelected = true; + break; // we need to select just one surface } } else { bSurfaceSelected = true; // Hackish - we will need a lot of refractoring here later } + } + + // execute mouse pressed events for surface GUIs + for ( int i=0; imousePressed(x, y, button); }