ui.position and collide with generic objects

ui.position and collide with generic objects

I would like to propose an extension of ui.position to "collide" with any object we have, either or both to collide with the whole object or just an edge. When "hitting" the object, the positioned element should be as near it's wanted position as possible while not intersecting the given edge. There might also need to be some vertical/horizontal modifier so we can limit the offset in one dimension.

Example code how it would work, our object will collide with the left and right edge of obj1 and keep strict vertical (y) level and adjusts it's horizontal (x). it will also collide on all edges with obj2 and obj3:
  1. $("#my_obj").position({
  2. my: 'center',
  3. at: 'center',
  4. of: parent',
  5. collide: [
  6. {
  7.  at: 'left right',
  8.  with: obj1,
  9.  keep: 'y'
  10. },
  11. {
  12.  with: [ obj2, obj3 ]
  13. }
  14. ]
  15. });