[Lua] Add eyedropper action to useTool#5692
Conversation
aseprite-bot
left a comment
There was a problem hiding this comment.
clang-tidy made some suggestions
| // Get the first point from the points table | ||
| lua_pushnil(L); | ||
| if (lua_next(L, -2) != 0) { | ||
| gfx::Point pt = convert_args_into_point(L, -1); |
There was a problem hiding this comment.
warning: variable 'pt' of type 'gfx::Point' (aka 'PointT') can be declared 'const' [misc-const-correctness]
| gfx::Point pt = convert_args_into_point(L, -1); | |
| gfx::Point const pt = convert_args_into_point(L, -1); |
| type = lua_getfield(L, 1, "points"); | ||
| if (type == LUA_TTABLE) { |
There was a problem hiding this comment.
It looks like these lines are duplicated, probably checking for the "points" tablet is the first thing we can do, and after that decide the eyedropper path or the ToolLoop one.
31b9eb2 to
9b2976d
Compare
aseprite-bot
left a comment
There was a problem hiding this comment.
clang-tidy made some suggestions
| } | ||
| // Do the tool loop for other tools | ||
| else { | ||
| InlineCommandExecution inlineCmd(ctx); |
There was a problem hiding this comment.
warning: variable 'inlineCmd' of type 'InlineCommandExecution' can be declared 'const' [misc-const-correctness]
| InlineCommandExecution inlineCmd(ctx); | |
| InlineCommandExecution const inlineCmd(ctx); |
| const bool isSelectionInk = (params.ink == | ||
| toolbox->getInkById(tools::WellKnownInks::Selection)); | ||
| const tools::Pointer::Button button = (!isSelectionInk ? | ||
| (buttonIdx == 0 ? tools::Pointer::Button::Left : |
There was a problem hiding this comment.
warning: conditional operator is used as sub-expression of parent conditional operator, refrain from using nested conditional operators [readability-avoid-nested-conditional-operator]
(buttonIdx == 0 ? tools::Pointer::Button::Left :
^Additional context
src/app/script/app_object.cpp:489: parent conditional operator here
const tools::Pointer::Button button = (!isSelectionInk ?
^| tools::Pointer::Button::Right) : | ||
| tools::Pointer::Button::Left); | ||
| while (lua_next(L, -2) != 0) { | ||
| gfx::Point pt = convert_args_into_point(L, -1); |
There was a problem hiding this comment.
warning: variable 'pt' of type 'gfx::Point' (aka 'PointT') can be declared 'const' [misc-const-correctness]
| gfx::Point pt = convert_args_into_point(L, -1); | |
| gfx::Point const pt = convert_args_into_point(L, -1); |
9b2976d to
dd19630
Compare
dd19630 to
ad7965b
Compare
No description provided.