From fd734328c77a02ac98c8f6b5be3d13144a97b3a2 Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Mon, 22 Feb 2016 21:44:32 +0100 Subject: [PATCH] Move all surfaces with the keyboard arrows if no surface selected --- src/Surfaces/SurfaceManager.cpp | 11 ++++++++++- src/Surfaces/SurfaceManager.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Surfaces/SurfaceManager.cpp b/src/Surfaces/SurfaceManager.cpp index da93a60..5b9c38b 100644 --- a/src/Surfaces/SurfaceManager.cpp +++ b/src/Surfaces/SurfaceManager.cpp @@ -212,6 +212,7 @@ void SurfaceManager::selectVertex(int i){ void SurfaceManager::moveSelectionBy(ofVec2f v){ if(selectedSurface == 0){ + moveAllSurfacesBy(v); return; } @@ -222,7 +223,15 @@ void SurfaceManager::moveSelectionBy(ofVec2f v){ selectedSurface->moveBy(v); } - // TODO: use member variable for this in the future + // TODO: instead of having single selected surface + // we want to have a selection of one or more. + // it could be implemented as vector here. +} + +void SurfaceManager::moveAllSurfacesBy(ofVec2f v){ + for(int i = 0; i < _surfaces.size(); ++i){ + _surfaces[i]->moveBy(v); + } } void SurfaceManager::deselectSurface(){ diff --git a/src/Surfaces/SurfaceManager.h b/src/Surfaces/SurfaceManager.h index 1afc8bc..b452e91 100644 --- a/src/Surfaces/SurfaceManager.h +++ b/src/Surfaces/SurfaceManager.h @@ -49,6 +49,7 @@ class SurfaceManager { void selectVertex(int i); void moveSelectionBy(ofVec2f v); + void moveAllSurfacesBy(ofVec2f v); int size(); int getSelectedVertexIndex();