mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-06 06:58:15 +00:00
Fix auto-pick of layers when alpha in 1...127 range (fix #2156)
The threshold of 50% was chosen to select layers that are more visible than others (whatever is the order of layers in the stack) but it might not be working as expected (e.g. if both composed layers has alpha < 128 it will select no layer at all). Maybe in the we could choose a higher threshold than 1, but let's see how it works for users.
This commit is contained in:
parent
6adbf899d4
commit
4ff77a4d55
@ -26,6 +26,8 @@ namespace app {
|
||||
|
||||
namespace {
|
||||
|
||||
const int kOpacityThreshold = 1;
|
||||
|
||||
bool get_cel_pixel(const Cel* cel,
|
||||
const double x,
|
||||
const double y,
|
||||
@ -93,7 +95,7 @@ void ColorPicker::pickColor(const Site& site,
|
||||
Preferences::instance().experimental.newBlend()));
|
||||
|
||||
doc::CelList cels;
|
||||
sprite->pickCels(pos.x, pos.y, site.frame(), 128,
|
||||
sprite->pickCels(pos.x, pos.y, site.frame(), kOpacityThreshold,
|
||||
sprite->allVisibleLayers(), cels);
|
||||
if (!cels.empty())
|
||||
m_layer = cels.front()->layer();
|
||||
@ -127,7 +129,7 @@ void ColorPicker::pickColor(const Site& site,
|
||||
|
||||
case FromFirstReferenceLayer: {
|
||||
doc::CelList cels;
|
||||
sprite->pickCels(pos.x, pos.y, site.frame(), 128,
|
||||
sprite->pickCels(pos.x, pos.y, site.frame(), kOpacityThreshold,
|
||||
sprite->allVisibleReferenceLayers(), cels);
|
||||
|
||||
for (const Cel* cel : cels) {
|
||||
|
Loading…
Reference in New Issue
Block a user