• Noel Power's avatar
    Sync draw object to calc grid for better alignment when zooming · c4e649f0
    Noel Power yazdı
    There can be some serious rounding errors involved when calculating where to
    draw the grid lines for the various row heights in a document. This can be
    especially true for a document that has many different row heights.
    This results in draw objects appearing to move relative to the grid line at
    different zoom levels.  This patch attempts to fix this problem adjusting
    the position of the shapes as they are drawn to ensure their position
    relative to grid appears to be stable.  We do this by translating the position
    of the shape to the corrosponding position of it's cell anchor. Of course not
    all shapes are cell anchored and in this case we position the shape relative
    a temporary synthesized cell anchor.
    The patch essentially does the following
    
    a) calculates the offset to be applied for each shape at the current zoom level
    to ensure that the shape will be drawn relative to the correct cell grid
       see drwlayer.cxx, drawview.cxx & gridwin3.cxx, svdobj.[ch]xx
    b) apply the offset in the drawing layer for each of the different drawing
    primitives see svx/source/sdr/contact/*
    c) making sure the position and size of the newly created shape ( at any zoom
    level ) are still as expected when zoom level is changed.
       see. sc/source/ui/drawfunc/fuco*.cxx &
    d) making sure that overlays and handles are displayed at the correct position
          see svx/source/svdraw/*
    
    it could also be that a full blown transform might be needed to additionally
    scale the object ( to ensure that the edges of the object stay stable relative
    to ajacent grid lines ) If necessary we could do that in a later step.
    
    Change-Id: I02232f8ba192d58dbf96b80adf66c281cd0f65e8
    c4e649f0
viewcontactofsdrobjcustomshape.cxx 11.1 KB