gotcha

Author Topic: Align (Center) based on only one item of a multi-item group?  (Read 1305 times)

November 02, 2018, 02:41:12 PM
Read 1305 times

Agrajag

  • Full Member

  • Offline
  • ****

  • 56
I have two objects that are part of a group (Object 1 and Object 2) and I don't want to lose their relative arrangement to one another. However, I'd like to center that group in the center of a larger rectangle, but only based on Object 1. In other words, center grouped item as if it's only based on Object one, but move both Object 1 and Object 2 as a group. Obviously Object 2 will be off-center, but that's fine for this.

Can I do that?
  • Windows 10

November 03, 2018, 10:12:54 AM
Reply #1

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
You could use snapping to snap the two object's center points to each other.

November 03, 2018, 04:44:18 PM
Reply #2

Agrajag

  • Full Member

  • Offline
  • ****

  • 56
You could use snapping to snap the two object's center points to each other.

Hmm. Can you be more specific on how to go about that? In other words you're saying I can snap the center point of Object 1 to the center point of the rectangle? I assume there's someway to show the centerpoints or is there a specific "Snap to Center Point" snapping option? Thanks! This sounds extremely useful.
  • Windows 10

November 03, 2018, 05:17:59 PM
Reply #3

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln

November 04, 2018, 02:49:31 AM
Reply #4

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
As I understand Moini's suggestion, and as I understand your question, what Moini suggests won't work.  Although full disclosure, I didn't watch the whole video.  But you certainly can use her guide to learn about setting up the snap control bar!

I think it will be tricky to do it using snapping, but I think it can be done, perhaps by using guides to make it easier.  Or perhaps using particular snap options....  Let me make up a quick test document, and then I can give you instructions.
« Last Edit: November 04, 2018, 03:27:24 AM by brynn »
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

November 04, 2018, 03:20:43 AM
Reply #5

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Ok, I can make it work using snapping only (no guides), in only one way, which instead of snapping the center of object 1 (of the group) to the center of the rectangle, is to snap the center of the rectangle to the center of object 1 (of the group).  Here's how I found that will work.

First, set up the snap control bar like in my screenshot (which essentially is disable every option except for snap to centers).  (Actually, snapping to grids and guides could still be enabled, if you aren't using any grids or guides in your file.)

I find it helpful to click twice on the objects, to see the rotation centers, just before I start, to make sure I'll be dragging the centers close enough to each other - especially if object 1 has an odd shape.

Then, the center of the rectangle should readily snap to the center of object 1, as long as you are bringing the center of the rectangle close enough to it.

In case you can't move the rectangle, here's a way to snap the center of object 1 to the center of the rectangle, and still keep object 1 and object 2 relative to each other.  They can't stay grouped, but they will still remain in their original places.  The same configuration of the snap control bar will work for this.

First, ungroup the group with object 1 and 2, but don't deselect anything.  This keeps everything together and selected, so that they are moving together, but Inkscape looks for the center of the objects rather than the center of the group.  Also, when you grab something to drag the former group, you must grab object 1.  As long as everything is still selected, everything will move together, even though you only grab object 1.  If you grab object 2, or any other object in the group, Inkscape will try to snap the center of whichever object you have grabbed.

So for clarity

1 - snap control bar like attached
2 - ungroup but don't deselect
3 - grab onto object 1
4 - drag so that the appropriate centers are coming close enough to each other  (if the objects are odd shapes, maybe click twice on them before you start, to get a mental picture of where the centers are, to make sure you are dragging close enough to each other)
5 - maybe re-group the selected objects, if you want to make sure they stay together later


Any luck?
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

November 04, 2018, 08:13:30 AM
Reply #6

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Works great for me...?

November 04, 2018, 11:56:06 AM
Reply #7

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Interesting.  I see you're using center of object rather than rotation center.  Let's see if that makes a difference for me.....

Oh yes, it does!  If I use the "Snap an item's rotation center" option, it only wants to snap the center of the group.  But if I disable that, and enable the "Snap center of objects" it does snap to the center of the object (not the group).

Is there some logical reason for that?  Or is it a surprise?  Well, it's a surprise to me.  But I mean for developers.

I always thought the snap center of objects was meant for the rare cases where the center of the object is not exactly the same spot as the rotation center.  But maybe it has some other meaning or use?

Really, I have rarely used that option.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

November 05, 2018, 03:13:59 PM
Reply #8

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
I'm not sure if it's intended to work just like that - the phrasing seems to indicate it's intentional. But I would call it a bug even if it was intentional.

November 05, 2018, 04:08:34 PM
Reply #9

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
I think I'll post to the mailing list and ask for clarification.  Maybe I'm not the only one who is confused?  Then we can find out it there's a bug involved, too.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

November 13, 2018, 07:45:35 AM
Reply #10

Agrajag

  • Full Member

  • Offline
  • ****

  • 56
I seem to be stuck in a bizarro world where things in one file work that don't work in another.

I was so excited to see Moini's solution and went to my first test of this and it worked great on one of my cards. Then I went to the next file and with the same exact snap settings it simply would not snap to the center of the same item (each of my cards has the same basic objects in them). Ugh..... Check out this file. It's identical in basic setup to all my other card templates except that for some reason NO snapping will work on it.

I also found a complication with this. As you can see from my SVG, I have multiple items right on top of each other and, in such cases, it's really difficult to know which "center" is the center of the object I'm concerned about.

What would be really optimal would be a means to select an item in a group and have its center snap with another center.
« Last Edit: November 13, 2018, 11:07:21 AM by Agrajag »
  • Windows 10

November 13, 2018, 11:45:49 AM
Reply #11

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Well I know this is going to be frustrating to hear.  But snapping seems to be working for me.  I've tried snapping existing objects, and I've tried pasting objects into it from other files.  (Was that you asking about pasting and snapping, in a different topic?  Or someone else?)

The only potential problem that I see might be happening, is if you're trying to snap to something in a locked layer.  I notice you have some locked layers, although I also see that they are hidden.

Oh, the text.  If you were trying to snap the blue rectangle to the 2 (for example) it looks like you'd have to also enable the snap to rotation center, in the snap control bar.  The same for the imorted raster images.  Snap to center won't work, you have to have snap to rotation center enabled.

This is exactly the question we're trying to get answered in the other topic (can't remember if it's your topic).  We want to know what's the difference between snapping to rotation centers and snapping to objects.  But it seems for snapping to centers, for different types of objects, you need a different options enabled.

Maybe it would be better to make it point to keep both options always enabled?
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

November 14, 2018, 04:42:49 PM
Reply #12

Agrajag

  • Full Member

  • Offline
  • ****

  • 56
Well I know this is going to be frustrating to hear.  But snapping seems to be working for me.  I've tried snapping existing objects, and I've tried pasting objects into it from other files.

Both good and bad to hear. On my side, here's an example of a test: You'll see a rectangle created by guidelines in the upper left corner of the card. I use that to create my rectangles to then attach other objects to for synchronized placement (like placing the suit/number from the upper left to the exact spot in the lower right, but of course only after inverting it).

This is not working for me. I can create the rectangle just fine, but once it's created, if I move it out of the space I used to create it and try to snap it back into place it won't snap there. It just floats over it like it's not there. This is all on the top Text layer which is unlocked and visible:

The snapping items I have on right now (right from top down): 1, 2, 3, 7, 13, 14, 17, 18, 19. What the heck would cause this?


  • Windows 10

November 14, 2018, 05:23:58 PM
Reply #13

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Different preferences files, maybe? Have you changed anything in your snap preferences?

November 14, 2018, 05:55:21 PM
Reply #14

Agrajag

  • Full Member

  • Offline
  • ****

  • 56
Different preferences files, maybe? Have you changed anything in your snap preferences?

Not that I can SEE and it works fine in 99% of all the other files which is quite a larger number very similar to this. Thinking my only option is to take the Rank 3 card of this suit and just change it to a Rank 2 card like this as that SVG doesn't have this issue for me. I don't get it. Something in my Inkscape is keeping that file from working.
« Last Edit: November 14, 2018, 08:05:55 PM by Agrajag »
  • Windows 10

November 15, 2018, 08:48:06 AM
Reply #15

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Ah, I think I see the problem!  To be able to snap the corners of the rectangle to the guide intersection, you need to have both Snap Smooth Nodes and Snap Corner/Cusp Nodes enabled.  (buttons #10 and 11, as you presented them).

Does that help?

In my experience, I'm constantly changing my snap options.  There is a particular configuration I use for "most of the time" or quick doodles when I'm trying to help someone figure something out.  But if it's a complex file or drawing, I often need to change the settings around, according to what I need.  Sometimes every few steps, and sometimes every couple of steps.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

November 16, 2018, 09:20:57 AM
Reply #16

Agrajag

  • Full Member

  • Offline
  • ****

  • 56
Ah, I think I see the problem!  To be able to snap the corners of the rectangle to the guide intersection, you need to have both Snap Smooth Nodes and Snap Corner/Cusp Nodes enabled.  (buttons #10 and 11, as you presented them).

Does that help?

YES! But it is confusing. What the heck does the last snap item -- Snap Guides do then??? I had that on and assumed that would snap objects to the guides and their intersections, but apparently it doesn't.
  • Windows 10


November 17, 2018, 08:32:37 PM
Reply #18

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Yes, you also need to have snapping to guides enabled.

As I recall, when snapping was first introduced, you had to enable options for both what was being snapped, and what you were snapping to.  And the names of the buttons (the tooltips, I mean) made that clear.  Now, as far as how the buttons are named, that distinction has become blurred quite a bit.  But you still need to keep that in mind, and make sure both have options enabled - the element being snapped and the element being snapped to, or target.

The reason I think you were getting snapping to happen sometimes, is because you have one 'snap to bounding box' option enabled (I forget which one without opening the file again), and it was sometimes snapping the bounding box. 

I know it's confusing!  It was probably a couple of years using snapping before I felt like I had a full grasp of it.  It is quite a complex tool!
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann