GUI: improve drag-and-drop, part 1 - BROKEN

This commit is contained in:
tildearrow 2023-01-29 19:34:47 -05:00
parent f33564039a
commit 72465cf09a
2 changed files with 14 additions and 3 deletions

View File

@ -50,8 +50,10 @@ void FurnaceGUI::startSelection(int xCoarse, int xFine, int y, bool fullRow) {
selecting=true;
selectingFull=false;
dragSourceX=xCoarse;
dragSourceXFine=xFine;
dragSourceY=y;
dragDestinationX=xCoarse;
dragDestinationXFine=xFine;
dragDestinationY=y;
dragStart=selStart;
dragEnd=selEnd;
@ -86,6 +88,7 @@ void FurnaceGUI::updateSelection(int xCoarse, int xFine, int y, bool fullRow) {
if (!selecting) return;
if (dragging) {
dragDestinationX=xCoarse;
if (dragStart.xFine>=3) dragDestinationXFine=(xFine|1);
dragDestinationY=y;
cursorDrag.xCoarse=xCoarse;
cursorDrag.xFine=xFine;
@ -104,6 +107,14 @@ void FurnaceGUI::updateSelection(int xCoarse, int xFine, int y, bool fullRow) {
dragDestinationX=lastChannel-(dragEnd.xCoarse-dragSourceX)-1;
}
if (dragStart.xFine>=3) {
logV("ddd: %d",dragStart.xFine+(dragDestinationXFine-dragSourceXFine));
if (dragStart.xFine+(dragDestinationXFine-dragSourceXFine)<3) {
dragDestinationXFine=dragStart.xFine+dragSourceXFine-3;
}
logV("ddxf: %d",dragDestinationXFine);
}
if (dragStart.y+(dragDestinationY-dragSourceY)<0) {
dragDestinationY=dragSourceY-dragStart.y;
}
@ -113,10 +124,10 @@ void FurnaceGUI::updateSelection(int xCoarse, int xFine, int y, bool fullRow) {
}
selStart.xCoarse=dragStart.xCoarse+(dragDestinationX-dragSourceX);
selStart.xFine=dragStart.xFine;
selStart.xFine=dragStart.xFine+(dragDestinationXFine-dragSourceXFine);
selStart.y=dragStart.y+(dragDestinationY-dragSourceY);
selEnd.xCoarse=dragEnd.xCoarse+(dragDestinationX-dragSourceX);
selEnd.xFine=dragEnd.xFine;
selEnd.xFine=dragEnd.xFine+(dragDestinationXFine-dragSourceXFine);
selEnd.y=dragEnd.y+(dragDestinationY-dragSourceY);
} else {
if (selectingFull) {

View File

@ -1453,7 +1453,7 @@ class FurnaceGUI {
int curIns, curWave, curSample, curOctave, curOrder, prevIns, oldRow, oldOrder, oldOrder1, editStep, exportLoops, soloChan,orderEditMode, orderCursor;
int loopOrder, loopRow, loopEnd, isClipping, extraChannelButtons, patNameTarget, newSongCategory, latchTarget;
int wheelX, wheelY, dragSourceX, dragSourceY, dragDestinationX, dragDestinationY, oldBeat, oldBar;
int wheelX, wheelY, dragSourceX, dragSourceXFine, dragSourceY, dragDestinationX, dragDestinationXFine, dragDestinationY, oldBeat, oldBar;
float soloTimeout;
double exportFadeOut;