src/widgets/Segments.js
changeset 986 f9d51dd4a3fe
parent 983 97fef7a4b189
child 990 6a90c96f0b4c
equal deleted inserted replaced
985:9859c4bae904 986:f9d51dd4a3fe
   106             });
   106             });
   107             _el.css({
   107             _el.css({
   108                 background: _el.hasClass("found") ? _this.found_color: color,
   108                 background: _el.hasClass("found") ? _this.found_color: color,
   109                 "z-index": ++zindex
   109                 "z-index": ++zindex
   110             });
   110             });
   111             _this.tooltip.show( _center, _top, _data.text, _data.color );
   111             if (_this.tooltip) {
       
   112                 _this.tooltip.show( _center, _top, _data.text, _data.color );
       
   113             }
   112         });
   114         });
   113         _annotation.on("unselect", function() {
   115         _annotation.on("unselect", function() {
   114             _this.tooltip.hide();
   116             if (_this.tooltip) {
       
   117                 _this.tooltip.hide();
       
   118             }
   115             _this.$segments.each(function() {
   119             _this.$segments.each(function() {
   116                 var _segment = IriSP.jQuery(this);
   120                 var _segment = IriSP.jQuery(this);
   117                 _segment.css("background", _segment.hasClass("found") ? _this.found_color : _segment.attr(searching ? "data-low-color" : "data-medium-color"));
   121                 _segment.css("background", _segment.hasClass("found") ? _this.found_color : _segment.attr(searching ? "data-low-color" : "data-medium-color"));
   118             });
   122             });
   119         });
   123         });
   129         width : this.width + "px",
   133         width : this.width + "px",
   130         height : (((1 - this.overlap) * lines.length + this.overlap) * this.line_height) + "px",
   134         height : (((1 - this.overlap) * lines.length + this.overlap) * this.line_height) + "px",
   131         background : this.background,
   135         background : this.background,
   132         margin: "1px 0"
   136         margin: "1px 0"
   133     });
   137     });
   134     this.insertSubwidget(this.$.find(".Ldt-Segments-Tooltip"), { type: "Tooltip" }, "tooltip");
   138     this.insertSubwidget(
       
   139         this.$.find(".Ldt-Segments-Tooltip"),
       
   140         {
       
   141             type: "Tooltip",
       
   142             min_x: 0,
       
   143             max_x: this.width
       
   144         },
       
   145         "tooltip"
       
   146     );
   135     this.$segments = this.$.find('.Ldt-Segments-Segment');
   147     this.$segments = this.$.find('.Ldt-Segments-Segment');
   136     this.source.getAnnotations().on("search", function() {
   148     this.source.getAnnotations().on("search", function() {
   137         searching = true;
   149         searching = true;
   138     });
   150     });
   139     this.source.getAnnotations().on("search-cleared", function() {
   151     this.source.getAnnotations().on("search-cleared", function() {