summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/color_picker.cpp6
-rw-r--r--scene/gui/graph_edit.cpp2
2 files changed, 5 insertions, 3 deletions
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index f8f8b1f6d1..bd24b43761 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -361,7 +361,10 @@ void ColorPicker::_preset_input(const InputEvent &ev) {
emit_signal("color_changed", color);
} else if (ev.type == InputEvent::MOUSE_MOTION) {
const InputEventMouse &mev = ev.mouse_motion;
- int index = mev.x/(preset->get_size().x/presets.size());
+ int index = mev.x * presets.size();
+ if( preset->get_size().x != 0 ) {
+ index /= preset->get_size().x;
+ }
if (index<0 || index >= presets.size())
return;
preset->set_tooltip("Color: #"+presets[index].to_html(presets[index].a<1)+"\n"
@@ -684,4 +687,3 @@ ColorPickerButton::ColorPickerButton() {
picker->connect("color_changed",this,"_color_changed");
add_child(popup);
}
-
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index c9c9dbd1d2..9123194589 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -617,7 +617,7 @@ void GraphEdit::_input_event(const InputEvent& p_ev) {
if (b.button_index==BUTTON_LEFT && b.pressed) {
- GraphNode *gn;
+ GraphNode *gn = NULL;
for(int i=get_child_count()-1;i>=0;i--) {
gn=get_child(i)->cast_to<GraphNode>();