Logo Search packages:      
Sourcecode: inkscape version File versions

NR::Coord namedview_free_snap ( SPNamedView const *  nv,
Snapper::PointType  t,
NR::Point &  req 
)

Try to snap req in both dimensions.

Parameters:
nv NamedView to use.
req Point to snap; updated to the snapped point if a snap occurred.
Returns:
Distance to the snap point, or NR_HUGE if no snap occurred.

Definition at line 62 of file snap.cpp.

References namedview_dim_snap().

{
    /* fixme: If allowing arbitrary snap targets, free snap is not the sum of h and v */
    NR::Point result = req;
      
    NR::Coord dh = namedview_dim_snap(nv, t, result, NR::X);
    result[NR::Y] = req[NR::Y];
    NR::Coord dv = namedview_dim_snap(nv, t, result, NR::Y);
    req = result;
      
    if (dh < NR_HUGE && dv < NR_HUGE) {
        return hypot (dh, dv);
    }

    if (dh < NR_HUGE) {
        return dh;
    }

    if (dv < NR_HUGE) {
      return dv;
    }
    
    return NR_HUGE;
}


Generated by  Doxygen 1.6.0   Back to index