Fix ColorPicker
inverted input on color circle
This commit is contained in:
parent
e445bacd90
commit
8be89357ce
3 changed files with 7 additions and 7 deletions
|
@ -464,7 +464,7 @@ void NavigationRegion2D::_notification(int p_what) {
|
||||||
draw_line(a, b, doors_color);
|
draw_line(a, b, doors_color);
|
||||||
|
|
||||||
// Draw a circle to illustrate the margins.
|
// Draw a circle to illustrate the margins.
|
||||||
real_t angle = b.angle_to_point(a);
|
real_t angle = a.angle_to_point(b);
|
||||||
draw_arc(a, radius, angle + Math_PI / 2.0, angle - Math_PI / 2.0 + Math_TAU, 10, doors_color);
|
draw_arc(a, radius, angle + Math_PI / 2.0, angle - Math_PI / 2.0 + Math_TAU, 10, doors_color);
|
||||||
draw_arc(b, radius, angle - Math_PI / 2.0, angle + Math_PI / 2.0, 10, doors_color);
|
draw_arc(b, radius, angle - Math_PI / 2.0, angle + Math_PI / 2.0, 10, doors_color);
|
||||||
}
|
}
|
||||||
|
|
|
@ -833,7 +833,7 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &p_event, Control *c) {
|
||||||
real_t dist = center.distance_to(bev->get_position());
|
real_t dist = center.distance_to(bev->get_position());
|
||||||
|
|
||||||
if (dist <= center.x) {
|
if (dist <= center.x) {
|
||||||
real_t rad = bev->get_position().angle_to_point(center);
|
real_t rad = center.angle_to_point(bev->get_position());
|
||||||
h = ((rad >= 0) ? rad : (Math_TAU + rad)) / Math_TAU;
|
h = ((rad >= 0) ? rad : (Math_TAU + rad)) / Math_TAU;
|
||||||
s = CLAMP(dist / center.x, 0, 1);
|
s = CLAMP(dist / center.x, 0, 1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -850,7 +850,7 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &p_event, Control *c) {
|
||||||
real_t dist = center.distance_to(bev->get_position());
|
real_t dist = center.distance_to(bev->get_position());
|
||||||
|
|
||||||
if (dist >= center.x * 0.84 && dist <= center.x) {
|
if (dist >= center.x * 0.84 && dist <= center.x) {
|
||||||
real_t rad = bev->get_position().angle_to_point(center);
|
real_t rad = center.angle_to_point(bev->get_position());
|
||||||
h = ((rad >= 0) ? rad : (Math_TAU + rad)) / Math_TAU;
|
h = ((rad >= 0) ? rad : (Math_TAU + rad)) / Math_TAU;
|
||||||
spinning = true;
|
spinning = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -895,12 +895,12 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &p_event, Control *c) {
|
||||||
Vector2 center = c->get_size() / 2.0;
|
Vector2 center = c->get_size() / 2.0;
|
||||||
if (picker_type == SHAPE_VHS_CIRCLE) {
|
if (picker_type == SHAPE_VHS_CIRCLE) {
|
||||||
real_t dist = center.distance_to(mev->get_position());
|
real_t dist = center.distance_to(mev->get_position());
|
||||||
real_t rad = mev->get_position().angle_to_point(center);
|
real_t rad = center.angle_to_point(mev->get_position());
|
||||||
h = ((rad >= 0) ? rad : (Math_TAU + rad)) / Math_TAU;
|
h = ((rad >= 0) ? rad : (Math_TAU + rad)) / Math_TAU;
|
||||||
s = CLAMP(dist / center.x, 0, 1);
|
s = CLAMP(dist / center.x, 0, 1);
|
||||||
} else {
|
} else {
|
||||||
if (spinning) {
|
if (spinning) {
|
||||||
real_t rad = mev->get_position().angle_to_point(center);
|
real_t rad = center.angle_to_point(mev->get_position());
|
||||||
h = ((rad >= 0) ? rad : (Math_TAU + rad)) / Math_TAU;
|
h = ((rad >= 0) ? rad : (Math_TAU + rad)) / Math_TAU;
|
||||||
} else {
|
} else {
|
||||||
real_t corner_x = (c == wheel_uv) ? center.x - Math_SQRT12 * c->get_size().width * 0.42 : 0;
|
real_t corner_x = (c == wheel_uv) ? center.x - Math_SQRT12 * c->get_size().width * 0.42 : 0;
|
||||||
|
|
|
@ -205,8 +205,8 @@ void SkeletonModification2DCCDIK::_execute_ccdik_joint(int p_joint_idx, Node2D *
|
||||||
} else {
|
} else {
|
||||||
// How to rotate from the tip: get the difference of rotation needed from the tip to the target, from the perspective of the joint.
|
// How to rotate from the tip: get the difference of rotation needed from the tip to the target, from the perspective of the joint.
|
||||||
// Because we are only using the offset, we do not need to account for the bone angle of the Bone2D node.
|
// Because we are only using the offset, we do not need to account for the bone angle of the Bone2D node.
|
||||||
float joint_to_tip = operation_transform.get_origin().angle_to_point(p_tip->get_global_position());
|
float joint_to_tip = p_tip->get_global_position().angle_to_point(operation_transform.get_origin());
|
||||||
float joint_to_target = operation_transform.get_origin().angle_to_point(p_target->get_global_position());
|
float joint_to_target = p_target->get_global_position().angle_to_point(operation_transform.get_origin());
|
||||||
operation_transform.set_rotation(
|
operation_transform.set_rotation(
|
||||||
operation_transform.get_rotation() + (joint_to_target - joint_to_tip));
|
operation_transform.get_rotation() + (joint_to_target - joint_to_tip));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue