summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/3d/navigation.cpp8
-rw-r--r--scene/gui/color_picker.cpp6
2 files changed, 9 insertions, 5 deletions
diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp
index 186f0d8e00..2b74d43ad2 100644
--- a/scene/3d/navigation.cpp
+++ b/scene/3d/navigation.cpp
@@ -64,7 +64,11 @@ void Navigation::_navmesh_link(int p_id) {
continue;
}
- p.center=center/plen;
+ p.center = center;
+ if( plen != 0 ) {
+ p.center /= plen;
+ }
+
//connect
@@ -721,5 +725,3 @@ Navigation::Navigation() {
last_id=1;
up=Vector3(0,1,0);
}
-
-
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);
}
-