Ejemplo n.º 1
0
void ViewportImp::update_viewbox( float dx, float dy, float scale ) { 
  
  this->x -= dx;
  this->y -= dy;
  this->span *= scale;
  set_viewbox( x, y, span );
}
Ejemplo n.º 2
0
void ViewportImp::update_viewbox( float dx, float dy, float scale ) {

  Matrix3x3 svg_2_norm = get_canvas_to_norm();
  Matrix3x3 translation = Matrix3x3::identity();
  translation(0, 0) = 1 / scale;
  translation(1, 1) = 1 / scale;
  translation(0, 2) = dx / span / 2 - (1 / scale - 1) / 2;
  translation(1, 2) = dy / span / 2 - (1 / scale - 1) / 2;
  set_canvas_to_norm(translation * svg_2_norm);

  this->x -= dx;
  this->y -= dy;
  this->span *= scale;
  set_viewbox( x, y, span );

}