-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#944 Reorder palette swatches with drag and drop #1283
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall it looks like it works after expectations, technically there are a few things I'd like to see fixed but it's minor stuff.
I noticed however that this only works for list mode, is there a reason why you haven't activated the same behaviour for grid mode?
Good work David 👍
Moving close bracket Co-Authored-By: Oliver Stevns <CandyFace@users.noreply.github.com>
Keeping code guidelines Co-Authored-By: Oliver Stevns <CandyFace@users.noreply.github.com>
Keeping coding guidelines Co-Authored-By: Oliver Stevns <CandyFace@users.noreply.github.com>
I have made the proposed changes - I think. |
app/src/colorpalettewidget.cpp
Outdated
editor()->object()->movePaletteColor(startIndex, endIndex); | ||
|
||
editor()->object()->addColour(editor()->object()->getColour(startIndex)); | ||
editor()->object()->moveVectorColor(startIndex, editor()->object()->getColourCount() - 1); | ||
for (int i = startIndex; i < endIndex; i++) | ||
{ | ||
editor()->object()->moveVectorColor(i + 1, i); | ||
} | ||
editor()->object()->moveVectorColor(editor()->object()->getColourCount() - 1, endIndex); | ||
} | ||
else | ||
{ | ||
if (start == row) { return; } | ||
|
||
startIndex = start; | ||
endIndex = row; | ||
|
||
editor()->object()->movePaletteColor(startIndex, endIndex); | ||
|
||
editor()->object()->addColour(editor()->object()->getColour(startIndex)); | ||
editor()->object()->moveVectorColor(startIndex, editor()->object()->getColourCount() - 1); | ||
for (int i = startIndex; i > endIndex; i--) | ||
{ | ||
editor()->object()->moveVectorColor(i - 1, i); | ||
} | ||
editor()->object()->moveVectorColor(editor()->object()->getColourCount() - 1, endIndex); | ||
} | ||
|
||
editor()->object()->removeColour(editor()->object()->getColourCount() - 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You call editor()->object a lot, consider creating a local Object* variable so that repeated reference lookup is avoided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some odd reason I had to make both Editor and Object local vars.
When I tried
mObject = editor()->object();
it crashed. It works fine now, with the usual setCore method.
More issues/comment to this one? |
Merging this one, knowing that the functionality doesn't work for grid view. |
A much needed feature, is the ability to drag and drop palette swatches.
You can select as many swatches as you want. For every drag and drop, the links to possible vector strokes are updated and re-indexed.
Tested on Ubuntu 18.04, Win10 and Mac.
This closes #944