Constraining x,y values of an image within a pinboard

Hi all, I am looking to simply constrain a “free” manipulatable image within a section of a pinboard.

Basically, I have an image that I want the user to be able to zoom into and move around, so the user can explore the details of the image. I’ve achieved that by putting the image within a pinboard that is much larger than the display area (I cannot use the deep zoom asset because my composition is going on an android device). This works well for when the image is large (zoomed in) but when the image is small it can get lost off screen easily. I’d like to create some custom script that:

  1. Checks the size and x,y coordinates of the manipulated image asset
  2. If the size is below a certain value, constrain the x,y coordinates to within the display area, i.e. if(x > 1920) x = 1920;

Does anyone know if something like this is possible? Or am I reaching with this software?
Thanks in advance for any suggestions/tips!

Hi @roisinberg and welcome to Intuiface community!

Although this won’t be an off-the-shelf feature of Intuiface, I can see several ways you could address that. Here are 2 I can think of

  • Use conditions on “is manipulated” triggers on your image. This trigger is raised at the end of a user manipulation, so you can test the x/y/w/h values and based on your algorithms, move that image to the position of your choice.
  • If the method above involves a lot of conditions, and if you only have 1 image in that pinboard, you could think of creating a custom Interface Asset (IA) whose job would be to compute the new position of the image, based on its x/y/w/h values. Use the “is manipulated” trigger to call a “compute” action on that IA, then use a trigger raised by that IA to move / resize the image to the given position. The advantage is that you can write your algorithm using real if / then / else in JS or .NET, depending on your target platform. The disadvantage is that you have to write code :slight_smile:
1 Like

Thanks Seb, sounds like a custom IA is the way to go!