src/widgets/Segments.js
changeset 986 f9d51dd4a3fe
parent 983 97fef7a4b189
child 990 6a90c96f0b4c
--- a/src/widgets/Segments.js	Fri Nov 30 10:49:26 2012 +0100
+++ b/src/widgets/Segments.js	Wed Dec 19 19:02:52 2012 +0100
@@ -108,10 +108,14 @@
                 background: _el.hasClass("found") ? _this.found_color: color,
                 "z-index": ++zindex
             });
-            _this.tooltip.show( _center, _top, _data.text, _data.color );
+            if (_this.tooltip) {
+                _this.tooltip.show( _center, _top, _data.text, _data.color );
+            }
         });
         _annotation.on("unselect", function() {
-            _this.tooltip.hide();
+            if (_this.tooltip) {
+                _this.tooltip.hide();
+            }
             _this.$segments.each(function() {
                 var _segment = IriSP.jQuery(this);
                 _segment.css("background", _segment.hasClass("found") ? _this.found_color : _segment.attr(searching ? "data-low-color" : "data-medium-color"));
@@ -131,7 +135,15 @@
         background : this.background,
         margin: "1px 0"
     });
-    this.insertSubwidget(this.$.find(".Ldt-Segments-Tooltip"), { type: "Tooltip" }, "tooltip");
+    this.insertSubwidget(
+        this.$.find(".Ldt-Segments-Tooltip"),
+        {
+            type: "Tooltip",
+            min_x: 0,
+            max_x: this.width
+        },
+        "tooltip"
+    );
     this.$segments = this.$.find('.Ldt-Segments-Segment');
     this.source.getAnnotations().on("search", function() {
         searching = true;