void View::Rotate (Graphic* g, Event& e) { Coord l, b, r, t; float cx, cy; damage->Incur(g); g->GetBox(l, b, r, t); g->GetCenter(cx, cy); RotatingRect rr(output, canvas, l, b, r, t, round(cx), round(cy), e.x,e.y); Track(e, rr); g->Rotate(rr.CurrentAngle(), cx, cy); g->Touch(); damage->Incur(g); Update(); }
void ViewerGraphic::Update () { GraphicComp* parent = (GraphicComp*) _view->GetGraphicComp()->GetParent(); if (parent != nil) { FullGraphic gs; totalGSGraphic(parent->GetGraphic(), gs); if (Different(this, &gs)) { Damage* damage = _view->GetViewer()->GetDamage(); damage->Incur(this); *(Graphic*)this = *(Graphic*)(&gs); damage->Incur(this); } } }
void View::Scale (Graphic* g, Event& e) { Coord l, b, r, t; float cx, cy, scale; damage->Incur(g); g->GetBox(l, b, r, t); g->GetCenter(cx, cy); ScalingRect sr(output, canvas, l, b, r, t, round(cx), round(cy)); Track(e, sr); scale = sr.CurrentScaling(); g->Scale(scale, scale, cx, cy); g->Touch(); damage->Incur(g); Update(); }
void View::Move (Graphic* g, Event& e) { Coord l, b, r, t, newl, newb; float dx, dy, mag = GetMagnification(); damage->Incur(g); g->GetBox(l, b, r, t); SlidingRect sr(output, canvas, l, b, r, t, e.x, e.y); Track(e, sr); sr.GetCurrent(newl, newb, r, t); dx = (newl - l) / mag; // get distance moved, corrected to reflect dy = (newb - b) / mag; // current magnification g->Translate(dx, dy); g->Touch(); // so that new position will be written out damage->Incur(g); Update(); }