Logo Search packages:      
Sourcecode: inkscape version File versions

void SPDesktop::zoom_absolute_keep_point ( double  cx,
double  cy,
double  px,
double  py,
double  zoom 
)

Zoom to point with absolute zoom factor.

Todo:
someone please fix calculations properly and remove this hack

Definition at line 745 of file desktop.cpp.

References NR::Rect::dimensions(), SPCanvas::getViewbox(), and set_display_area().

Referenced by zoom_absolute(), and zoom_relative_keep_point().

{
    zoom = CLAMP (zoom, SP_DESKTOP_ZOOM_MIN, SP_DESKTOP_ZOOM_MAX);

    // maximum or minimum zoom reached, but there's no exact equality because of rounding errors;
    // this check prevents "sliding" when trying to zoom in at maximum zoom;
    /// \todo someone please fix calculations properly and remove this hack
    if (fabs(expansion(_d2w) - zoom) < 0.0001*zoom && (fabs(SP_DESKTOP_ZOOM_MAX - zoom) < 0.01 || fabs(SP_DESKTOP_ZOOM_MIN - zoom) < 0.000001))
        return;

    NR::Rect const viewbox = canvas->getViewbox();

    double const width2 = viewbox.dimensions()[NR::X] / zoom;
    double const height2 = viewbox.dimensions()[NR::Y] / zoom;

    set_display_area(cx - px * width2,
                     cy - py * height2,
                     cx + (1 - px) * width2,
                     cy + (1 - py) * height2,
                     0.0);
}


Generated by  Doxygen 1.6.0   Back to index