From b4294c4545baa8b229ad8bee8e74810d0220b0e0 Mon Sep 17 00:00:00 2001
From: vitalets <noginsk@rambler.ru>
Date: Sat, 29 Jun 2013 10:59:41 +0400
Subject: [PATCH] add collision flag to adjust tooltip position, fix #281

---
 CHANGELOG.txt                      |  1 +
 src/containers/editable-tooltip.js | 12 ++++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 13cb8ff..44126cd 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -3,6 +3,7 @@ X-editable changelog
 
 Version 1.4.6 wip
 ----------------------------
+[enh #281] add coliision flag to jQuery UI tooltip (vitalets)
 [bug #279] fix jQuery UI tooltip z-index to be less than select2 dropdown (vitalets)
 [bug #276] support id() and text() functions of select2 (vitalets)
 
diff --git a/src/containers/editable-tooltip.js b/src/containers/editable-tooltip.js
index 395c2eb..0c9a51f 100644
--- a/src/containers/editable-tooltip.js
+++ b/src/containers/editable-tooltip.js
@@ -78,25 +78,29 @@
                case 'top':
                       pos = {
                           my: "center bottom-5", 
-                          at: "center top" 
+                          at: "center top", 
+                          collision: 'flipfit'
                       };
                break;
                case 'right':
                       pos = {
                           my: "left+5 center", 
-                          at: "right center" 
+                          at: "right center", 
+                          collision: 'flipfit'
                       };
                break;
                case 'bottom':
                       pos = {
                           my: "center top+5", 
-                          at: "center bottom" 
+                          at: "center bottom", 
+                          collision: 'flipfit'
                       };
                break;
                case 'left':
                       pos = {
                           my: "right-5 center", 
-                          at: "left center" 
+                          at: "left center", 
+                          collision: 'flipfit'
                       };
                break;                                             
            }