Inkscape.org
Beginners' Questions How to center group around object midpoint? [X-POST from stackoverflow.com]
  1. #1
    GirkovArpa GirkovArpa @GirkovArpa

    screenshot

    I want to vertically center the diamond on the page, but preserve the position of the crown relative to the diamond.

    I can't group (or select all) then center, because that centers the group using the center of the bounding-box as the midpoint.

    I want to center the group, while keeping the midpoint of the group the same as the midpoint of the diamond.

    I could drag the midpoint of the group to the same location as the diamond's midpoint, but the diamond's midpoint is only marked while I'm selecting just the diamond.  So I can't see it when I'm trying to center the group.

  2. #2
    Polygon Polygon @Polygon🌶
    *

    You can group crown + diamond and because crown fits inside the bounding box width of the diamond it will align to this bounding relative to the page.

  3. #3
    GirkovArpa GirkovArpa @GirkovArpa

    That only works for horizontal centering.  I want to vertically center the diamond, while preserving the position of the crown relative to the diamond.

  4. #4
    GirkovArpa GirkovArpa @GirkovArpa

    The buttons are confusingly labeled in Inkscape.  What's called "vertical align: middle" in CSS is called "Center on horizontal axis" in Inkscape.  In your GIF you're horizontally centering the image.  I specifically said I want to vertically center it.

  5. #5
    Polygon Polygon @Polygon🌶

    This is what I did then. Why is your design not symmetrical in first place?

     

  6. #6
    GirkovArpa GirkovArpa @GirkovArpa
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <svg
       xmlns:dc="http://purl.org/dc/elements/1.1/"
       xmlns:cc="http://creativecommons.org/ns#"
       xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
       xmlns:svg="http://www.w3.org/2000/svg"
       xmlns="http://www.w3.org/2000/svg"
       xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
       xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
       width="56.526794mm"
       height="59.751286mm"
       viewBox="0 0 56.526794 59.751284"
       version="1.1"
       id="svg4661"
       inkscape:version="1.0.2-2 (e86c870879, 2021-01-15)"
       sodipodi:docname="triple-diamond-director.svg">
      <title
         id="title4711">Triple Diamond Director</title>
      <defs
         id="defs4655" />
      <sodipodi:namedview
         id="base"
         pagecolor="#ffffff"
         bordercolor="#666666"
         borderopacity="1.0"
         inkscape:pageopacity="0.0"
         inkscape:pageshadow="2"
         inkscape:zoom="0.7"
         inkscape:cx="-168.38344"
         inkscape:cy="141.21355"
         inkscape:document-units="mm"
         inkscape:current-layer="layer1"
         inkscape:document-rotation="0"
         showgrid="false"
         fit-margin-top="0"
         fit-margin-left="0"
         fit-margin-right="0"
         fit-margin-bottom="0"
         inkscape:window-width="1346"
         inkscape:window-height="728"
         inkscape:window-x="4"
         inkscape:window-y="0"
         inkscape:window-maximized="0" />
      <metadata
         id="metadata4658">
        <rdf:RDF>
          <cc:Work
             rdf:about="">
            <dc:format>image/svg+xml</dc:format>
            <dc:type
               rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
            <dc:title>Triple Diamond Director</dc:title>
          </cc:Work>
        </rdf:RDF>
      </metadata>
      <g
         inkscape:label="Layer 1"
         inkscape:groupmode="layer"
         id="layer1"
         transform="translate(-314.35267,-125.78605)">
        <g
           id="g3866-0-0-4"
           style="display:inline"
           transform="translate(284.89592,3.3584226)">
          <path
             style="fill:#a7c1da;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
             d="m 36.189226,141.49175 h 20.24734 l -9.427765,16.32937 -17.552048,-4.70305 z"
             id="path3778-6-7-2" />
          <path
             style="fill:#8aabcd;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
             d="m 30.643555,156.33518 24.337044,24.33704 -8.205494,-20.82687 -17.299844,-4.63548 z"
             id="path3780-52-1-8" />
          <path
             style="fill:#6894b5;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
             d="m 57.521063,144.38181 -8.34471,13.67681 h 16.855526 z"
             id="path3782-4-5-3" />
          <path
             style="fill:#6f95be;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
             d="m 49.040722,160.2358 h 16.890969 l -8.360382,21.94311 z"
             id="path3786-9-3-5" />
          <path
             style="display:inline;fill:#6e97b5;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
             d="m 79.247308,141.49175 h -20.24734 l 9.427765,16.32937 17.552048,-4.70305 z"
             id="path3778-5-9-5-7" />
          <path
             style="display:inline;fill:#4b779a;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
             d="m 84.815251,156.33518 -24.337044,24.33704 8.205494,-20.82687 17.299844,-4.63548 z"
             id="path3780-5-3-2-2" />
        </g>
        <path
           style="display:inline;fill:#4a77ab;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
           d="m 321.37018,142.71971 h 42.91388 v -7.84078 c 0,0 -3.39639,4.36324 -10.67805,4.36324 -7.28165,0 -10.67756,-4.27783 -10.67756,-4.27783 0,0 -3.20659,4.26626 -10.39099,4.26626 -7.1844,0 -11.35719,-4.27821 -11.35719,-4.27821 z"
           id="path4077-4" />
        <rect
           style="display:inline;fill:#4a77ab;fill-opacity:1;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none"
           id="rect4079-2"
           width="4.1724749"
           height="4.1724749"
           x="328.89859"
           y="-141.58943"
           transform="rotate(45)" />
        <rect
           style="display:inline;fill:#4a77ab;fill-opacity:1;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none"
           id="rect4079-3-8"
           width="4.1724749"
           height="4.1724749"
           x="344.34546"
           y="-157.03629"
           transform="rotate(45)" />
        <path
           style="display:inline;fill:#4a77ab;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
           d="m 339.92495,128.79414 2.84143,4.9215 2.89349,-5.01166 -2.91792,-2.91793 z"
           id="path4305" />
      </g>
    </svg>
    

    Checkout these screenshots.  The first shows the group vertically centered.  The second shows the diamond and crown individually centered.  

    In the first screenshot, neither diamond _nor_ crown are positioned how I want.

    In the second screenshot, only the _diamond_ is positioned how I want.

    Does that better illustrate what I'm trying to achieve?

  7. #7
    Tyler Durden Tyler Durden @TylerDurden

    Maybe this:

  8. #8
    Paddy_CAD Paddy_CAD @Paddy_CAD

    A variation of Polygon's method:  Draw some temporary construction lines centred on the diamond and create a group.  Delete them when you're happy with the arrangement.

  9. #9
    Polygon Polygon @Polygon🌶
    *
    GirkovArpa

    Does that better illustrate what I'm trying to achieve?

    Unfortunately not for me. I just guess you want to maintain the white/negative space between crown and diamond. Diamond still not symmetrical. But when diamond is in the right place the crown will be cropped - Screenshot and file are not having the same page aspect ratio:

  10. #10
    Paddy_CAD Paddy_CAD @Paddy_CAD

    Like Dr. Frankenstein, I will animate this lifeless husk!  < cue lightning flash >

  11. #11
    GirkovArpa GirkovArpa @GirkovArpa

    Thanks guys.  @Paddy_CAD's technique looks simplest so I think I'll try that one for now 😎  

    I understand the cropping issue but I'll just resize the page.

Inkscape Inkscape.org Inkscape Forum Beginners' Questions How to center group around object midpoint? [X-POST from stackoverflow.com]