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; }
int FilmTrans::move( CEvent &e, State *& ) { DEVice_2d* ptr = dynamic_cast<DEVice_2d*>(e._d); assert(ptr); if (_obj) { Wpt cur(Wpt(ptr->cur(),_down_pt)); Wpt old(Wpt(ptr->old(),_down_pt)); _obj->mult_by(Wtransf::translation(cur-old)); if (_call_xform_obs) XFORMobs::notify_xform_obs(_obj, XFORMobs::MIDDLE); } return 0; }