Inkscape.org
Beyond the Basics Inkscape 3 : "Resize page to selection" make the selected jump off grid
  1. #1
    Marc Defossez Marc Defossez @Deffe

    Hi,

    Making a symbol or something else and selecting then the whole drawing to adapt the page size to just the drawing makes after [Edit] - [Resize page to selection] the drawing jump off grid.
    In most cases it's very visible but in some cases it is nearly invisible.
    When I started working with previous version this was also an issue and it got solved, but this 'annoyance' is back now. 

    It would not be such a problem if the resized and off grid figure could be used in a new drawing positioned on the grid but that is not possible.
    The figure jumps off grid and when after saving it, it is imported in a new drawing it is not possible to drop it / snap it back on the grid.

    The strange thing is that it looks as if the grid jumps and not the drawing.
    I've attached two screenshots as a zip, one with the drawing on grid and the second, after resize page to selection, where the figure is now off grid.

    Does somebody knows a workaround?

    Many thanks for a reply

     

    Linux kernel: 5.15.0-78-generic
    Linux Mint 20 Cinnamon (4.6.7)
    Inkscape 1.3 (1:1.3+202307231459+0e150ed6c4)

  2. #2
    Tyler Durden Tyler Durden @TylerDurden

    I have not replicated on my test file. (v 1.3, Mint 21 Cinnamon)

    Please provide an example file.

  3. #3
    Marc Defossez Marc Defossez @Deffe
    *

    Hi Tyler,

    Made a small screen recording 
    I'm redoing a library of electronic components done in previous versions. Release of 1.3 looked a good opportunity to make the library look nice and uniform again.
    So set these document parameters:
    - scale: 1.00000
    - grid spacing (X & Y): 0.25  
    - Major grid line every: 4
    - Starting zoom at 186%
    Grid is visible and enabled with snap to grid lines on.

    At the begin you can see the component as it is made by  a previous version.
    I need to realign all pins to the grid, resize the labels and align the pin labels to the grid locked pins.
    Video is then paused till nearly everything is done.
    Then I show the selection of the entire component and select [Edit] [Resize Page to Selection]
    Now you can see the grid jump and the component is suddenly placed off grid. (show also with the small horizontal line)
    When zooming out to the original zoom size of 186% it's even more visible that the pins are off grid.

    Regards,
    Marc
     

  4. #4
    Marc Defossez Marc Defossez @Deffe

    Because only 21 MB could be uploaded, find here the original file from where to start the modifications.

    Regards,

    Marc
     

    Kcpsm6 Rom 2
  5. #5
    Paddy_CAD Paddy_CAD @Paddy_CAD
    *

    Open the Document Properties dialog [shift+ctrl+d] and the [Grids] tab. Note that your grid origin is not aligned to the page border, i.e. [Origin X:] and [Origin Y:] are non-zero. This offset was retained when you resized the page. Set these to zero to align the grid to the page.  

    Aside: Your svg has 28 objects and 18204 unused definitions. Use [File > Clean Up Document] to shrink the file from 6.4MB to 22KB.

  6. #6
    Marc Defossez Marc Defossez @Deffe

    @Paddy_CAD,

    Many Thanks for the reply!

    Regards,

  7. #7
    Aero Aero @Aero◻️

    Looks like a bug to me. 

    Happens with new document (A4 1mm per user unit) using a rectangle positioned away from the page border.

    Does not happen with new from template (A4 1px per user unit).
     

  8. #8
    Marc Defossez Marc Defossez @Deffe

    @Aero,

    Maybe a similar thing as I have with the conversion from one grid to another applies.
    A4 document at 1 mm needs a grid a 1 mm.
    Is grid units set to mm?
    By default it is on px.

    Cheers,

  9. #9
    Aero Aero @Aero◻️

    Yes, the grid is in mm, spacing is 1 and origins is 0 for both documents.

    The only difference between the templates is the scale (viewBox in document properties).
     

  10. #10
    Marc Defossez Marc Defossez @Deffe
    *

    Hi,
    The reason @Paddy_CAD for the grid jump sounded logical.
    So I gave it a try, but could not make the grid stay under the component or the component stay on the grid.
    Then @Aero came with the remark about a mm and grid jumping.
    This morning I had to make a complete new component for the library and discovered that even then the grid jumps under the component.
    So, it seems that the logic of @Paddy_CAD is not the solution.

    To show that the grid moves/jumps I made a small video, attached here.
    The test drawing is attached too.

    The machine is still teh same:
    - Linux kernel: 5.15.0-78-generic
    - Linux Mint 20 Cinnamon (4.6.7)
    - Inkscape 1.3 (1:1.3+202307231459+0e150ed6c4)
    The settings are still the same:
    - scale: 1.00000
    - grid spacing (X & Y): 0.25 
    - Major grid line every: 4
    - Starting zoom at 186%
    - Display and grid units: mm
    Grid is visible and enabled with snap to grid lines on.

    This really looks as a bug

    Regards,

    Testdrawing 02Aug23
  11. #11
    Marc Defossez Marc Defossez @Deffe

    Some extra information:

    It has nothing tio do with mm or px as display and grid units.
    I tried the same experiment but now with teh display and grid changed to px and the grid still moves.
    See the small video.

  12. #12
    Aero Aero @Aero◻️

    Sharing my test files.

    Applying "Resize page to selection" behave different due to document scale.

    25.4
    96
  13. #13
    Paddy_CAD Paddy_CAD @Paddy_CAD
    *

    @Deffe @Aero I have to agree with you both, there's definitely a bug here. 

    For this screenshot I drew a rectangle (with grid snapping), selected it, then resized the page [shift+ctrl+r]. Clearly my grid is not aligned with the new page even though document properties shows the grid origin at (0,0). When I add grid2 it appears at (0,0) as expected, but grid1 is then updated to reflect the origin offset seen on-screen.

    I'm not sure that document scale is relevant. I used [Scale: 1.0000] for this experiment.

    Grid1
    Grid2
  14. #14
    Aero Aero @Aero◻️

    Did you try New from Template...?

    Screenshot 67
  15. #15
    Marc Defossez Marc Defossez @Deffe

    @Aero: I just did.
    That seems to work, grid does not jump.
    I took:
    A4, vertical
    Display and grid units: mm
    The template scale set to: 0,264583 and the grid spacing X & Y is set to: 0,06615

    But the scale and grid are not what I normally use (grid and scale are chosen so that the svg that rolls out Inkscape can be used in two other tools).
    Even if it works with a template it's still not a solution for me.

  16. #16
    Aero Aero @Aero◻️

    Please report it. Works in 1.2.2.

    May be related to this.
    https://gitlab.com/inkscape/inkscape/-/merge_requests/5246

  17. #17
    Aero Aero @Aero◻️
    *

    Possible workaround for 1.3:

    Open the User UI folder found in Inkscape Preferences System. Place a copy of units.xml in this folder.

    The default factor for CSS Pixels in units.xml is 1. Change this factor to the same as the one used for millimeters.

    After restarting Inkscape the scale should now be the same for both New and New from Template... The grid should also work as expected when Resize page to selection is used.

    Unfortunately this may also affect the size of some UI elements in Inkscape.

    Edit: Default grid settings is set in preferences.

    Set Grid Defaults
  18. #18
    Tyler Durden Tyler Durden @TylerDurden

    I also advise this to be reported as a bug.

  19. #19
    Marc Defossez Marc Defossez @Deffe

    @Tyler : The issue is created as 

    Kind regards

    Marc

  20. #20
    Marc Defossez Marc Defossez @Deffe

    @Aero,
    Thanks for the hint with the xml file.
    I placed a copy of the system unit.xml in the user UI directory and modified the CSS pixels factor (1) to the factor associated with mm (3.779527559055119).
    When starting Inkscape the paper size, normally showing as a square on screen is now moved to the left top corner. Hitting [5] to do a [zoom page] places the page back as it should be.
    For the rest everything seems normal, until I start drawing something.
    - Selecting to draw a rectangle shows the icon (replacing the pointer) huge and thick.
    - The square lines are very wide but than can be changed by adapting the Stroke style width.
    But what is most annoying is that the normal mouse pointer is also huge and thick.

    I tried to do a screen shot, including the mouse, but that seems not to work.

    The workaround is not that of a good solution.
    As I wrote, I reported it on Gitlabs as a bug.

    Regards,
     

  21. #21
    Aero Aero @Aero◻️
    *
    Deffe

    When starting Inkscape the paper size, normally showing as a square on screen is now moved to the left top corner. Hitting [5] to do a [zoom page] places the page back as it should be.

    Doesn't happen with Inkscape default template. Delete your user template (default.svg) stored in Preferences-System-User templates.
     

    Aero

    Unfortunately this may also affect the size of some UI elements in Inkscape.

    Cursor scaling can be turned off in Preferences-Interface-Mouse cursor.
    This will make the cursor smaller, but unfortunately it is still tied to the size of the CSS Pixel in units.xml.

    Deffe

    - Selecting to draw a rectangle shows the icon (replacing the pointer) huge and thick.
    - The square lines are very wide but than can be changed by adapting the Stroke style width.
    But what is most annoying is that the normal mouse pointer is also huge and thick.

    To make the cursors normal with cursor scaling on, I modified the cursors (attached) and placed them in Preferences-System-User icons, hicolor\cursors.

  22. #22
    Chris Papademetrious Chris Papademetrious @chrispitude
    *

    Marc - thanks for reporting this! I am encountering it too.

    If you are using Windows, consider using ScreenToGIF for recording videos of Inkscape. Set the frames per second to 10, and reduce the number of colors to 16, 32, or 64. This should keep image size down, and as a bonus, you can use animated GIFs directly in Inkscape forum posts and issue reports.

  23. #23
    Aero Aero @Aero◻️

    This is fixed now. I just tested the Windows developer build.

    Scale grid translation to document unit scale
    https://gitlab.com/inkscape/inkscape/-/pipelines
     

Inkscape Inkscape.org Inkscape Forum Beyond the Basics Inkscape 3 : "Resize page to selection" make the selected jump off grid