Commit 6f41b7eb authored by Jule Marcoueille's avatar Jule Marcoueille

- Correction du scrolling qui ne decalait pas les coms

- Correction des fonctions de scroll au clavier
- Ajout des fonctions de scroll vertical au clavier
parent 8d3db6c2
......@@ -368,7 +368,7 @@ void Render_opengl::paintGL(){
/* Draw counters */
glPushMatrix();
glTranslated(_default_entity_x_translate - _state_translate , 0.0f, _z_counter);
glTranslated(_default_entity_x_translate - _state_translate , _y_state_translate, _z_counter);
glScalef(_state_scale*((_render_width-_default_entity_x_translate)/(_state_x_max-_state_x_min)), _y_state_scale*(_render_height-_ruler_height)/_container_y_max, 0.0f);
if (glIsList(_list_counters) == GL_FALSE) {
......@@ -636,16 +636,36 @@ void Render_opengl::wheelEvent(QWheelEvent * event){
void Render_opengl::keyPressEvent(QKeyEvent * event){
if (Qt::Key_Left == event->key()){
switch (event->key()){
case Qt::Key_Left:
/*
* Key 'left' pressed.
*/
change_translate(-1);
}else if (Qt::Key_Right == event->key()){
break;
case Qt::Key_Right:
/*
* Key 'right' pressed.
*/
change_translate(1);
break;
case Qt::Key_Up:
/*
* Key 'up' pressed.
*/
change_translate_y(1);
break;
case Qt::Key_Down:
/*
* Key 'down' pressed.
*/
change_translate_y(-1);
break;
default:
/*
* Unknow key pressed.
*/
break;
}
event->accept();/* accept the event */
......@@ -686,11 +706,13 @@ void Render_opengl::replace_scale(Element_pos new_scale){
void Render_opengl::change_translate(int translate){
if ( ( translate > 0 ) /* translation to the left */
&& ( ((_state_translate+_state_scale) - _default_entity_x_translate) >= (_state_x_max+_render_width)*_state_scale ) ){
&& ( (_state_translate / _state_scale) >= 100 ) ){
return;
}else if ( ( translate < 0 ) /* translation to the right */
&& ( (_default_entity_x_translate+_state_x_max - (_state_translate+translate)) >= _render_width) ){
}
else if ( ( translate < 0 ) /* translation to the right */
&& ( (_state_translate / _state_scale) <= 0 ) ){
return;
}
......@@ -699,6 +721,21 @@ void Render_opengl::change_translate(int translate){
}
void Render_opengl::change_translate_y(int translate){
if ( ( translate > 0 ) /* translation to the top */
&& ( (-_y_state_translate / _y_state_scale) <= 0 ) ){
return;
}else if ( ( translate < 0 ) /* translation to the bottom */
&& ( (-_y_state_translate / _y_state_scale) >= 100 ) ){
return;
}
_y_state_translate += translate;
updateGL();
}
void Render_opengl::replace_translate(Element_pos new_translate){
if (0 == new_translate){/* show the beginning states */
......
......@@ -402,7 +402,7 @@ class Render_opengl : public QGLWidget, public Render
Element_pos _default_entity_x_translate;
/*!
* Distance between to ruler measures.
* Distance between two ruler measures.
*/
Element_pos _ruler_distance;
......@@ -512,6 +512,12 @@ class Render_opengl : public QGLWidget, public Render
*/
void change_translate(int translate);/* temporary -> to change the translate to view states */
/*!
* \brief Change the y position of camera view for state drawing area.
* \param translate The new position.
*/
void change_translate_y(int translate);/* temporary -> to change the translate to view states */
/*!
* \brief Replace the current x translate by a new translate.
* \param new_translate The new translate value to replace the current translate.
......@@ -877,7 +883,7 @@ inline void Render_opengl::draw_stored_arrows(std::vector<Arrow_> &arrows){
glPushMatrix();
glTranslated(end_time, end_height, _z_arrow);
glTranslated(end_time, end_height+_y_state_translate, _z_arrow);
glScalef(2, 2, 0);/* should be set */
......@@ -905,7 +911,7 @@ inline void Render_opengl::draw_stored_arrows(std::vector<Arrow_> &arrows){
glPushMatrix();
glTranslated(0, 0, _z_arrow);
glTranslated(0, _y_state_translate, _z_arrow);
// glLineWidth(1.5f);
glBegin(GL_LINES);
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment