mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-23 18:39:55 +00:00
Fix color wheel radius (fix #2737)
This commit is contained in:
parent
d13f10212a
commit
779bf09893
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2020 Igara Studio S.A.
|
// Copyright (C) 2020-2021 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -94,7 +94,7 @@ app::Color ColorWheel::getMainAreaColor(const int _u, const int umax,
|
|||||||
int r = 128 + di*std::cos(a);
|
int r = 128 + di*std::cos(a);
|
||||||
int g = 128 + di*std::sin(a);
|
int g = 128 + di*std::sin(a);
|
||||||
int b = 255 - di;
|
int b = 255 - di;
|
||||||
if (d < m_wheelRadius+2*guiscale()) {
|
if (d <= m_wheelRadius) {
|
||||||
return app::Color::fromRgb(
|
return app::Color::fromRgb(
|
||||||
base::clamp(r, 0, 255),
|
base::clamp(r, 0, 255),
|
||||||
base::clamp(g, 0, 255),
|
base::clamp(g, 0, 255),
|
||||||
@ -106,7 +106,7 @@ app::Color ColorWheel::getMainAreaColor(const int _u, const int umax,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pick from the wheel
|
// Pick from the wheel
|
||||||
if (d < m_wheelRadius+2*guiscale()) {
|
if (d <= m_wheelRadius) {
|
||||||
double a = std::atan2(-v, u);
|
double a = std::atan2(-v, u);
|
||||||
|
|
||||||
int hue = (int(180.0 * a / PI)
|
int hue = (int(180.0 * a / PI)
|
||||||
@ -178,8 +178,8 @@ void ColorWheel::onPaintMainArea(ui::Graphics* g, const gfx::Rect& rc)
|
|||||||
{
|
{
|
||||||
bool oldHarmonyPicked = m_harmonyPicked;
|
bool oldHarmonyPicked = m_harmonyPicked;
|
||||||
|
|
||||||
int r = std::min(rc.w/2, rc.h/2);
|
double r = std::max(1.0, std::min(rc.w, rc.h) / 2.0);
|
||||||
m_wheelRadius = r;
|
m_wheelRadius = r-0.1;
|
||||||
m_wheelBounds = gfx::Rect(rc.x+rc.w/2-r,
|
m_wheelBounds = gfx::Rect(rc.x+rc.w/2-r,
|
||||||
rc.y+rc.h/2-r,
|
rc.y+rc.h/2-r,
|
||||||
r*2, r*2);
|
r*2, r*2);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2021 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -68,7 +69,7 @@ namespace app {
|
|||||||
|
|
||||||
gfx::Rect m_wheelBounds;
|
gfx::Rect m_wheelBounds;
|
||||||
gfx::Color m_bgColor;
|
gfx::Color m_bgColor;
|
||||||
int m_wheelRadius;
|
double m_wheelRadius;
|
||||||
bool m_discrete;
|
bool m_discrete;
|
||||||
ColorModel m_colorModel;
|
ColorModel m_colorModel;
|
||||||
Harmony m_harmony;
|
Harmony m_harmony;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user