[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeplasma-addons/applets/bball
From: Artur Duque de Souza <asouza () kde ! org>
Date: 2009-09-03 20:11:53
Message-ID: 1252008713.676409.16978.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1019532 by asouza:
The bouncing ball had wrong m_position when the applet
was moved using the applet's sidebar. Fixed now.
M +14 -3 bball.cpp
M +1 -1 bball.h
--- trunk/KDE/kdeplasma-addons/applets/bball/bball.cpp #1019531:1019532
@@ -54,7 +54,8 @@
m_x_vel(0.0),
m_y_vel(0.0),
m_circum_vel(0.0),
- m_mouse_pressed(false)
+ m_mouse_pressed(false),
+ m_refresh_pos(false)
{
setHasConfigurationInterface (true);
//TODO figure out why it is not good enough to set it here
@@ -243,8 +244,13 @@
setBackgroundHints(NoBackground);
}
+ if (constraints & Plasma::LocationConstraint) {
+ // m_position needs to be updated
+ m_refresh_pos = true;
+ }
+
if (constraints & Plasma::SizeConstraint) {
- m_position = QRectF(geometry().x(), geometry().y(), geometry().width(), geometry().height());
+ m_position = geometry();
m_radius = static_cast<int>(geometry().width()) / 2;
updateScaledBallImage();
}
@@ -303,7 +309,7 @@
m_x_vel *= -m_resitution;
adjustAngularVelocity( &m_y_vel, -m_circum_vel );
m_circum_vel = -m_y_vel;
- if (m_bottom == 1)
+ if (m_bottom == 1)
{
//kDebug() << "HIT Bottom AND RIGHT";
m_x_vel = 0.0;
@@ -450,6 +456,11 @@
return;
}
+ if (m_refresh_pos) {
+ m_refresh_pos = false;
+ m_position = geometry();
+ }
+
m_x_vel = 0;
m_y_vel = 0;
m_circum_vel = 0;
--- trunk/KDE/kdeplasma-addons/applets/bball/bball.h #1019531:1019532
@@ -80,7 +80,7 @@
Plasma::Svg m_ball_img;
QPixmap m_pixmap;
double m_x_vel, m_y_vel, m_gravity, m_resitution, m_friction, m_circum_vel, m_auto_bounce_strength;
- bool m_mouse_pressed, m_sound_enabled, m_auto_bounce_enabled, m_overlay_enabled;
+ bool m_mouse_pressed, m_sound_enabled, m_auto_bounce_enabled, m_overlay_enabled, m_refresh_pos;
QTimer *m_timer;
//Config dialog
Ui::bballConfig ui;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic