Skip to content

Commit

Permalink
Layer list: improve dragging visuals
Browse files Browse the repository at this point in the history
  • Loading branch information
MrStevns committed Sep 8, 2024
1 parent bf6ba4c commit 495eea8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 0 additions & 1 deletion app/src/timelinelayercell.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class TimeLineLayerCell : public TimeLineBaseCell
int getLayerNumber(int posY) const;

bool didDetach() const { return mDidDetach; }
bool hasDetached() const { return mIsDraggable; }
const Layer* layer() const { return mLayer; }

signals:
Expand Down
9 changes: 8 additions & 1 deletion app/src/timelinelayerlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ int TimeLineLayerList::getLayerGutterYPosition(int posY) const
if(posY > getLayerCellY(layerNumber)) {
layerNumber--;
}
int maxLayerNum = mEditor->layers()->count() - 1;
if (layerNumber > maxLayerNum) {
layerNumber = maxLayerNum;
} else if (layerNumber < 0) {
layerNumber = 0;
}
return getLayerCellY(layerNumber);
}

Expand Down Expand Up @@ -254,7 +260,7 @@ void TimeLineLayerList::onCellDragged(const DragEvent& event, const TimeLineLaye
break;
}
case DragEvent::ENDED: {
int dragToNumber = getLayerNumber(mGutterPositionY);
int dragToNumber = getLayerNumber(mGutterPositionY - (mLayerHeight * 0.5));
if (!mScrollingVertically && dragToNumber != mFromLayer && dragToNumber > -1)
{
if (dragToNumber < mEditor->layers()->count())
Expand All @@ -274,6 +280,7 @@ void TimeLineLayerList::onCellDragged(const DragEvent& event, const TimeLineLaye
}
emit cellDraggedY(event, y);
mGutterPositionY = -1;
mFromLayer = -1;
break;
}
}
Expand Down

0 comments on commit 495eea8

Please sign in to comment.