Beispiel #1
0
int
Cam_int::zoom2(
   CEvent &e,
   State *&
   )
{
   if (debug_fsa)
      cerr << "Cam_int::zoom2"
           << endl;

   DEVice_2d  *ptr =  (DEVice_2d *)e._d;
   CAMptr      cam    (e.view()->cam());
   PIXEL       curpt  (ptr->cur());
   XYpt        startpt(_start_pix);
   int w,h;    e.view()->get_size(w,h);

   double zoom_factor =  1 + Sign(ptr->delta()[0]) * 
      (PIXEL(ptr->cur())-PIXEL(ptr->old())).length()/(w/4);

   cam->set_zoom(cam->zoom() * zoom_factor);
   cam->set_min (cam->min() + NDCvec(XYpt(_start_pix) - startpt));

   ptr->set_cur(curpt);
   cam->data()->changed();
   
   return 0;
}
Beispiel #2
0
int
Cam_int_edit::pan2(
   CEvent &e,
   State *&
   )
{
   DEVice_2d  *ptr=(DEVice_2d *)e._d;
   CAMptr      cam  (e.view()->cam());
   PIXEL       curpt(ptr->cur());

   cam->set_min(cam->min() + NDCvec(ptr->delta()));
   cam->data()->changed();
   ptr->set_cur(curpt);
   return 0;
}
Beispiel #3
0
int
Cam_int::pan2(
   CEvent &e,
   State *&
   )
{
   if (debug_fsa)
      cerr << "Cam_int::pan2"
           << endl;

   DEVice_2d  *ptr=(DEVice_2d *)e._d;
   CAMptr      cam  (e.view()->cam());
   PIXEL       curpt(ptr->cur());

   cam->set_min(cam->min() + NDCvec(ptr->delta()));
   cam->data()->changed();
   ptr->set_cur(curpt);
   return 0;
}