fix #36 - PieChart always getting input

This commit is contained in:
Nicolò Santilio 2021-01-08 21:01:33 +01:00
parent b25e692f14
commit ed90863a1d
3 changed files with 14 additions and 9 deletions

View File

@ -1,7 +1,8 @@
*Want to stay updated or having an issue?*
<p align="right">
<a href="https://discord.gg/KnJGY9S">
<img src="https://github.com/fenix-hub/ColoredBadges/blob/master/svg/social/discord.svg" alt="react" style="vertical-align:top; margin:6px 4px">
<img src="https://github.com/fenix-hub/ColoredBadges/blob/master/svg/social/discord.svg" alt="react" style="vertical-align:top; margin:6px 4px">
</a>
</p>
<img src="addons/easy_charts/icon.png" align="left" width="64" height="64">
# Easy Charts
A library of Charts plotted in Control, 2D and 3D nodes to visualize general purpose datasets.

View File

@ -6,6 +6,7 @@
[node name="PieChart" type="Control"]
anchor_right = 1.0
anchor_bottom = 0.993333
mouse_filter = 1
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": true
@ -24,10 +25,12 @@ Chart_Modifiers/rotation = 0.0
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
mouse_filter = 1
[node name="Points" type="Control" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
mouse_filter = 1
__meta__ = {
"_edit_use_anchors_": false
}
@ -44,6 +47,7 @@ __meta__ = {
use_parent_material = true
anchor_right = 1.0
anchor_bottom = 0.0233333
mouse_filter = 1
align = 1
valign = 1
__meta__ = {
@ -53,9 +57,9 @@ __meta__ = {
[node name="PointData" parent="." instance=ExtResource( 2 )]
[node name="PointData" parent="PointData" index="0"]
margin_left = -63.9924
margin_top = -129.716
margin_right = -64.0923
margin_bottom = -128.916
margin_left = -375.27
margin_top = -216.457
margin_right = -375.37
margin_bottom = -215.657
[editable path="PointData"]

View File

@ -210,10 +210,10 @@ func _draw_areas():
var mouse_on_area : int
var mouse_on_slice : bool = false
func _input(event):
func _gui_input(event : InputEvent):
if event is InputEventMouseMotion:
for area_idx in range(areas.size()):
if Geometry.is_point_in_polygon(event.global_position - rect_position, areas[area_idx]):
if Geometry.is_point_in_polygon(event.global_position - get_global_transform().origin, areas[area_idx]):
mouse_on_slice = true
mouse_on_area = area_idx
show_slice_data(slices[area_idx])