Jump to content
You must now use your email address to sign in [click for more info] ×

Command to make two objects switch position


Recommended Posts

When doing page layout work or screen design, it is extremely common that two objects on a page need to exchange places.

The manual approach is rather tedious: Select one of them, drag it out of the page (or on top of the other), select the second object, move the second object exactly into the position of the firast object, and then to select the first object again and move it to exactly the same position that the second was in before. In some cases, even temporary guides or helper objects will be involved to ensure accurate positioning.

A simple menu command or keyboard shortcut that just swaps the XY position of two objects would make this common task much quicker.

Just select two objects, press a key and they are exchanged.

Similar options could be created to swap the contents of two picture frames or to swap objects while maintaining the boundary rectangle by scaling them to occupy the same space.

switch object position.png

Link to comment
Share on other sites

Just some thoughs of mine
not really shure if i am right

Instead of move them manually
Would group them and do a Horizontal Flip in your case not work ?
Then double click on the single Object and do it once more
for every single Object

1718738196_horizontalflip-1.png.ea719c33e28092495b6bf89b1238e2c7.png

 

To switch the position for something like this
a additional vertical flip is needed

horizonta--vertical-flip.png.c8d98f5eb638176f5da94072c1bb85d9.png

 

To use Symbols may also be a way ?

Double click on a Symbol, Paste another
Shape in it and double click on the old shape
in the Symbol and delete it.

symbols.png.ab10568748d424f55dd8aa429836e66a.png

 

 

 

 

Link to comment
Share on other sites

It would work and it's certainly a better approach than manually repositioning them.

But it has disadvantages over a dedicated command:

  • It's a minimum of 7 operations (group, flip, ungroup, select, flip, select, flip), 10 if you have to flip in both directions
  • It will not respect the transform origin set in the Transform panel
  • It is not an intuitive process for a user, particularly if the objects are on different pages or artboards
  • It does not have an option to rewire text frames within a text flow (we'd have to discuss if this is desireable behaviour or not though)
Link to comment
Share on other sites

  1. Select them.
  2. Rotate Right.
  3. Rotate Right.
  4. Horizontal flip.

No need to group anything.

Mac Pro (Late 2013) Mac OS 12.7.4 
Affinity Designer 2.4.1 | Affinity Photo 2.4.1 | Affinity Publisher 2.4.1 | Beta versions as they appear.

I have never mastered color management, period, so I cannot help with that.

Link to comment
Share on other sites

7 minutes ago, Old Bruce said:
  1. Select them.
  2. Rotate Right.
  3. Rotate Right.
  4. Horizontal flip.

No need to group anything.

Doesn't the cat end up upside-down?

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

13 minutes ago, Old Bruce said:
  1. Select them.
  2. Rotate Right.
  3. Rotate Right.
  4. Horizontal flip.

No need to group anything.

Applying the first three steps of your recipe to the pair of images in the original post would put the cat upside down. Vertical (not horizontal!) flipping would turn it the right way up, but with the tail on the wrong side, so you would need to flip it horizontally to restore the original orientation.

Alfred spacer.png
Affinity Designer/Photo/Publisher 2 for Windows • Windows 10 Home/Pro
Affinity Designer/Photo/Publisher 2 for iPad • iPadOS 17.4.1 (iPad 7th gen)

Link to comment
Share on other sites

All of these flip/rotate tricks break if the objects are different sizes and you want to maintain the center positions.

The command as originally requested impresses me as something that should be relatively simple to write a script for once that functionality is available then assign it a keyboard shortcut of your own.

If Serif does not provide this before then it would not be the end of the world.

Link to comment
Share on other sites

1 hour ago, Alfred said:

would put the cat upside down

1 hour ago, walt.farrell said:

Doesn't the cat end up upside-down?

877586651_ScreenShot2023-05-11at12_39_51PM.png.cd00bbb14f431c2ba963000977a32a54.png   1979622715_ScreenShot2023-05-11at12_40_04PM.png.29fc0b123a47eedba22d9e3576cc0324.png

Arghhhh...

I didn't pay attention to the images in the first posts.

I just used some coloured rectangles.

562138783_ScreenShot2023-05-11at12_46_42PM.png.6a54287a81568177c2c9d69879bfbb1f.png 

 1958782120_ScreenShot2023-05-11at12_46_54PM.png.7545fcbd2b56475105c4f7583db10f03.png

Foiled by symmetry. [unbelievably embarrassed emoticon]

Mac Pro (Late 2013) Mac OS 12.7.4 
Affinity Designer 2.4.1 | Affinity Photo 2.4.1 | Affinity Publisher 2.4.1 | Beta versions as they appear.

I have never mastered color management, period, so I cannot help with that.

Link to comment
Share on other sites

On 5/10/2023 at 5:53 PM, Peter Werner said:

The manual approach is rather tedious: Select one of them, drag it out of the page (or on top of the other), select the second object, move the second object exactly into the position of the firast object, and then to select the first object again and move it to exactly the same position that the second was in before.

I use for this Transform panel.

 

Affinity Store (MSI/EXE): Affinity Suite (ADe, APh, APu) 2.4.0.2301
Dell OptiPlex 7060, i5-8500 3.00 GHz, 16 GB, Intel UHD Graphics 630, Dell P2417H 1920 x 1080, Windows 11 Pro, Version 23H2, Build 22631.3155.
Dell Latitude E5570, i5-6440HQ 2.60 GHz, 8 GB, Intel HD Graphics 530, 1920 x 1080, Windows 11 Pro, Version 23H2, Build 22631.3155.
Intel NUC5PGYH, Pentium N3700 2.40 GHz, 8 GB, Intel HD Graphics, EIZO EV2456 1920 x 1200, Windows 10 Pro, Version 21H1, Build 19043.2130.

Link to comment
Share on other sites

First I converted the Shapes to Curves just to make it easier for snapping. Then I drew some temporary spacers. Then I duplicated one of the two different shapes, moved it and moved the other and deleted the original.

 

 

Mac Pro (Late 2013) Mac OS 12.7.4 
Affinity Designer 2.4.1 | Affinity Photo 2.4.1 | Affinity Publisher 2.4.1 | Beta versions as they appear.

I have never mastered color management, period, so I cannot help with that.

Link to comment
Share on other sites

It's really interesting to see all these different ways to achive the desired result, but I think these demo videos being 20 seconds long are a testimony to the fact that there is indeed a potential to save time with a dedicated command.

I think it's one of these small things that can really add up if you use a software every day. All of these can be achieved in some other fashion, but after a while of using these workarounds, it just feels like there should be a faster way.

A similar thing that I run into constantly is whishing for a command to quickly break a multi-column text frame into individual linked frames (corresponding feature request post here).

 

Link to comment
Share on other sites

2 hours ago, Peter Werner said:

a potential to save time with a dedicated command

This of course applies to any specific (perhaps even bizarre) case of a sequence of commands. But as mentioned above, a macro/script is much more suitable for these sequences, not a "dedicated command", because hundreds of them would be needed.

P.S.

2 hours ago, Peter Werner said:

these demo videos being 20 seconds

It is necessary to take into account the fact that it is a "demo", in which there are a lot of unnecessary delays and actions that will not be performed when executing your own command. The resulting duration of the action is therefore significantly shorter.

Affinity Store (MSI/EXE): Affinity Suite (ADe, APh, APu) 2.4.0.2301
Dell OptiPlex 7060, i5-8500 3.00 GHz, 16 GB, Intel UHD Graphics 630, Dell P2417H 1920 x 1080, Windows 11 Pro, Version 23H2, Build 22631.3155.
Dell Latitude E5570, i5-6440HQ 2.60 GHz, 8 GB, Intel HD Graphics 530, 1920 x 1080, Windows 11 Pro, Version 23H2, Build 22631.3155.
Intel NUC5PGYH, Pentium N3700 2.40 GHz, 8 GB, Intel HD Graphics, EIZO EV2456 1920 x 1200, Windows 10 Pro, Version 21H1, Build 19043.2130.

Link to comment
Share on other sites

16 hours ago, Pšenda said:

a macro/script is much more suitable for these sequences

I did write one for breaking a frame into columns in InDesign at some point. I ended up using it so often that I wondered why they never added it to the core feature set.

16 hours ago, Pšenda said:

not a "dedicated command", because hundreds of them would be needed.

Could you give some other examples? Most of the ones I can think of are already there ("Align Vertically", "Convert Art Text to Text Frame", "Swap Stroke and Fill Color", "Duplicate Layer", …)

I'm actually genuinely curious because if these things aren't added, I'm thinking about writing a script as soon as we have support for that.

16 hours ago, Pšenda said:

It is necessary to take into account the fact that it is a "demo"

I did. My point is that these are not one or two click solutions. 12 seconds versus 2 seconds easily adds up.

Link to comment
Share on other sites

@GripsholmLion

Well, I think you are not alone. If there was the possibility
in Affinity Designer surely everyone would like to use it.

Of course nobody knows if Affinity will ever implement it.
So for the time being we have to look for a workaround.

Or to hope that such things can be realized with scripting
once it is implemented.

Link to comment
Share on other sites

7 hours ago, Peter Werner said:

Could you give some other examples?

For example, someone very often needs to switch objects with each other, but requires that the applied fx remains in the same position (it was not transferred with the previous object to new position). That is a sequence of many commands that takes a long time, which you say is "a testimony to the fact that there is indeed a potential to save time with a dedicated command".

Affinity Store (MSI/EXE): Affinity Suite (ADe, APh, APu) 2.4.0.2301
Dell OptiPlex 7060, i5-8500 3.00 GHz, 16 GB, Intel UHD Graphics 630, Dell P2417H 1920 x 1080, Windows 11 Pro, Version 23H2, Build 22631.3155.
Dell Latitude E5570, i5-6440HQ 2.60 GHz, 8 GB, Intel HD Graphics 530, 1920 x 1080, Windows 11 Pro, Version 23H2, Build 22631.3155.
Intel NUC5PGYH, Pentium N3700 2.40 GHz, 8 GB, Intel HD Graphics, EIZO EV2456 1920 x 1200, Windows 10 Pro, Version 21H1, Build 19043.2130.

Link to comment
Share on other sites

7 hours ago, Peter Werner said:

My point is that these are not one or two click solutions.

I apologize for trying to suggest a significantly faster procedure than the one you are using:

On 5/10/2023 at 5:53 PM, Peter Werner said:

Select one of them, drag it out of the page (or on top of the other), select the second object, move the second object exactly into the position of the firast object, and then to select the first object again and move it to exactly the same position that the second was in before. In some cases, even temporary guides or helper objects will be involved to ensure accurate positioning.

But apparently you like this procedure, so feel free to continue using it.

Affinity Store (MSI/EXE): Affinity Suite (ADe, APh, APu) 2.4.0.2301
Dell OptiPlex 7060, i5-8500 3.00 GHz, 16 GB, Intel UHD Graphics 630, Dell P2417H 1920 x 1080, Windows 11 Pro, Version 23H2, Build 22631.3155.
Dell Latitude E5570, i5-6440HQ 2.60 GHz, 8 GB, Intel HD Graphics 530, 1920 x 1080, Windows 11 Pro, Version 23H2, Build 22631.3155.
Intel NUC5PGYH, Pentium N3700 2.40 GHz, 8 GB, Intel HD Graphics, EIZO EV2456 1920 x 1200, Windows 10 Pro, Version 21H1, Build 19043.2130.

Link to comment
Share on other sites

19 minutes ago, Pšenda said:

someone very often needs to switch objects with each other, but requires that the applied fx remains in the same position

My estimate would be that for an average serious user of Affinity Publisher, swapping the position of two objects is a task that comes up at least once or twice per session, whereas the use case you give is much more specialized. If I had to guess, I would estimate that they differ by at least a factor 1000 in frequency of relevance for the average user.

If you say it's something that comes up in your work a lot, I'd be happy to include such an option for you if we end up having to go the scripting route.

1 minute ago, Pšenda said:

I apologize for trying to suggest a significantly faster procedure than the one you are using:

I am sorry if you got the impression that I somehow do not value your contribution to this discussion. My point was that even with the faster process you suggested, it's still significantly less efficient than a dedicated solution. It also has other disadvantages, such as the fact that the software only displays floating point numbers with a limited precision in the UI, so copy pasting coordinates may cause position shifts in some cases.

7 minutes ago, Pšenda said:

But apparently you like this procedure, so feel free to continue using it.

I'm not sure how to respond to this in a constructive way – the reason why we are having this discussion in the first place is that I don't like that procedure.

Link to comment
Share on other sites

I think this could be a useful function to have, but I also think some consideration needs to be given to what is meant by switch “position”.

As has been mentioned above, does this mean:

  • the X/Y position of the bounding boxes, or;
  • the X/Y position of the shapes, or;
  • the centres of the bounding boxes, or;
  • the centres of the shapes, or;
  • something else?

And what would happen if either or both of the layers is/are:

  • rotated, and/or;
  • skewed, and/or;
  • flipped?

Consider my attached image (the blue rectangles are the bounding boxes).
Which coordinates of the two filled shapes should be “switched”?
In the lower area I’ve given examples (green rectangles) of just four places the “switched” layer bounding box could end up.

And how would the user choose which one they want?

It’s a nice idea but good luck coming up with a good set of instructions for how it would work in practice, because that’s what the developers would need to do. And if you can’t tell them what it needs to do then how can they make it do what you want?

image.png.9db4f0b96650f2b086b0909c8e639cad.png

Link to comment
Share on other sites

Well, I have no problem sharing even unusual ideas.

So here's one. How about grouping all the shapes that
will probably need to be replaced, and only color the one
you use in the appropriate place.

The other shapes/symbols with no colors and no outline
would be invisible. And it would be easy to color what you use at a time.

switch-1.png.77d6d0b36530e422817277bfcee3607e.png

 

switch-2.png.cb81bac3376c895d1486aa417b583d58.png

Link to comment
Share on other sites

Further to what @GarryP has shown. Here is the problem with swapping two objects of different sizes. Do they get swapped according to the top/middle/bottom  x, y coordinates of the centre, the left, or the right?

The original

750598224_ScreenShot2023-05-14at8_42_07AM.png.8c2029c91866bd4f52d507cfb66bb7b4.png

The possibilities

2007437813_ScreenShot2023-05-14at8_42_46AM.png.7d42daa353b4db61139b19cab716aeb9.png

Mac Pro (Late 2013) Mac OS 12.7.4 
Affinity Designer 2.4.1 | Affinity Photo 2.4.1 | Affinity Publisher 2.4.1 | Beta versions as they appear.

I have never mastered color management, period, so I cannot help with that.

Link to comment
Share on other sites

7 hours ago, GarryP said:

some consideration needs to be given to what is meant by switch “position”.

3 hours ago, Old Bruce said:

Do they get swapped according to the top/middle/bottom  x, y coordinates of the centre, the left, or the right?

My suggestion would be to respect the setting of the transformation origin widget in the Transform panel to determine which anchor to use for position switching.

image.png.e5b189a114588479ee45421ba509216d.png

With respect to individual object transform, I would suggest to just keep all local transformations like rotation/flip/skew etc. associated with the object since this would match what most people would intuitively assume the result of such an operation to be:

1829591647_Screenshot2023-05-14212035.png.003d68d4e4f32cdcc6222f6c9ca73368.png

I think anything more advanced than that would need so much user input that it would defeat the purpose as it would no longer be a one-click operation.

That being said, I could indeed imagine a "Switch Attributes" command or script that gives the user a dialog box with checkboxes for granular control of which attributes of an object to transfer and whether to switch or copy attributes between the objects. So you could check or uncheck "position", "rotation" etc. individually, but also "effects", "style", "stroke attributes", "fill attributes", "blend mode" etc. Another approach might be a "Copy Attributes"/"Paste Attributes" type of set of commands. Similar to corresponding features in Adobe Lightroom (pictured below), DaVinci Resolve or Autodesk Maya. But again, that would solve a different problem.

image.png.c4df8431ef38127420a1d30eb2cb88fb.png

Link to comment
Share on other sites

12 hours ago, Peter Werner said:

My suggestion would be to respect the setting of the transformation origin widget in the Transform panel to determine which anchor to use for position switching.

When I was considering your suggestion earlier I too thought that the transform origin widget might be a good control to use but, after a while, I wasn’t too sure. I don’t have any specific objections to it being used in this way but there is a vague worry in the back of my mind saying that giving this widget ‘double duty’ could cause some problems somewhere along the road.

12 hours ago, Peter Werner said:

With respect to individual object transform, I would suggest to just keep all local transformations like rotation/flip/skew etc. associated with the object since this would match what most people would intuitively assume the result of such an operation to be

To try and make myself a bit more clear, I wasn’t suggesting that the rotation/skew/flipped-ness of the layers would be swapped.
I mentioned them because each operation changes at least some of the coordinates of the layer.

For example, consider my next attached image.
The black rectangle is a standard Rectangle shape and the black/white dotted line is it’s bounding box.
The blue rectangle is the original rotated by 45 degrees clockwise with a corresponding boundary box.
The red rectangle is the original skewed by 45 degrees from the bottom-left with a corresponding boundary box.
(I won’t show the flipped rectangle for reasons that should be obvious.)

Each operation changes some, if not all, of the coordinates of the rectangle and its bounding box.
Therefore, when you are telling the software to “switch positions” of two layers, the X/Y positions of the different coordinates of the two layers could be wildly different to what you might expect.

For example, in my attached video, you can see that the X/Y position of the Original rectangle is at 742x540 (approx.).
But, the X/Y value of the Rotated rectangle is also at 742x540 (approx.) even though its top-left corner is not in the same place and the bounding box is obviously much larger and situated differently.
However, the X position of the Skewed rectangle (1042 approx.) is very different to the X value of the original (742 approx.) while the Y value is the same (540).

The same sort of thing goes for the bounding boxes and even more so when you apply multiple operations.
And the centre of each layer may also be in a different place.

My point is, what you mean by X/Y may not be what the software thinks is X/Y and so, when you want it to “switch positions”, which “positions” are actually getting “switched”?

I’ve attached my document so you can play around with it.

Hopefully I’ve been able to make myself a bit more clear this time.

image.png.fddc85cd63ff2c889fd949e6fe11ba9f.png

swapping-positions2.afdesign

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.