From b4eba3e98ed58f1dbfe454d702653e6caefc9635 Mon Sep 17 00:00:00 2001 From: BossCode45 Date: Sun, 28 Aug 2022 20:44:00 +1200 Subject: Frame disolving for window moving --- main.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/main.cpp b/main.cpp index 57c85e3..1a5af57 100644 --- a/main.cpp +++ b/main.cpp @@ -118,6 +118,7 @@ void wToWS(const KeyArg arg) { if(pSF[i] == fID) { + //Frame disolve pSF.erase(pSF.begin() + i); int pID = frames.find(fID)->second.pID; if(pSF.size() < 2 && !frames.find(pID)->second.isRoot) @@ -233,7 +234,25 @@ void wMove(const KeyArg arg) if(pID!=oPID) { + //Frame dissolve oPSF.erase(oPSF.begin() + i); + if(oPSF.size() < 2 && !frames.find(oPID)->second.isRoot) + { + //Erase parent frame + int lastChildID = frames.find(frames.find(oPID)->second.subFrameIDs[0])->second.ID; + int parentParentID = frames.find(oPID)->second.pID; + vector& parentParentSubFrameIDs = frames.find(parentParentID)->second.subFrameIDs; + for(int j = 0; j < parentParentSubFrameIDs.size(); j++) + { + if(parentParentSubFrameIDs[j] == oPID) + { + parentParentSubFrameIDs[j] = lastChildID; + frames.find(lastChildID)->second.pID = parentParentID; + frames.erase(oPID); + break; + } + } + } frames.find(fID)->second.pID = pID; pSF.push_back(fID); -- cgit v1.2.3