156 |
156 |
157 this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.timeUpdateHandler)); |
157 this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.timeUpdateHandler)); |
158 var _this = this; |
158 var _this = this; |
159 this.selector |
159 this.selector |
160 .click(IriSP.wrap(this, this.clickHandler)) |
160 .click(IriSP.wrap(this, this.clickHandler)) |
161 .mousemove(function(event) { |
161 .mousemove(function(_e) { |
162 _this.updateTooltip(event); |
162 _this.updateTooltip(_e); |
163 |
163 // Trace |
164 // Also tell the world where the mouse is hovering. |
164 var relX = _e.pageX - _this.selector.offset().left; |
165 var relX = event.pageX - _this.selector.offset().left; |
165 var _duration = _this._serializer.getDuration(); |
166 var duration = _this._serializer.getDuration(); |
166 var _time = parseInt((relX / _this.width) * _duration); |
167 var Time = ((relX / _this.width) * duration).toFixed(2); |
167 _this._Popcorn.trigger("IriSP.TraceWidget.MouseEvents", { |
168 _this._Popcorn.trigger("IriSP.StackGraphWidget.mouseOver", Time); |
168 "widget" : "StackGraphWidget", |
|
169 "type": "mousemove", |
|
170 "x": _e.pageX, |
|
171 "y": _e.pageY, |
|
172 "time": _time |
|
173 }); |
169 |
174 |
170 }) |
175 }) |
171 .mouseout(function() { |
176 .mouseout(function() { |
172 _this.TooltipWidget.hide(); |
177 _this.TooltipWidget.hide(); |
173 _this.rectangleFocus.attr({ |
178 _this.rectangleFocus.attr({ |
196 this._Popcorn.trigger("IriSP.StackGraphWidget.clicked", newTime); |
201 this._Popcorn.trigger("IriSP.StackGraphWidget.clicked", newTime); |
197 this._Popcorn.currentTime(newTime); |
202 this._Popcorn.currentTime(newTime); |
198 }; |
203 }; |
199 |
204 |
200 IriSP.StackGraphWidget.prototype.updateTooltip = function(event) { |
205 IriSP.StackGraphWidget.prototype.updateTooltip = function(event) { |
201 var _segment = Math.floor(this.sliceCount * (event.pageX - this.selector.offset().left)/this.width), |
206 var _segment = Math.max(0,Math.min(this.groups.length - 1, Math.floor(this.sliceCount * (event.pageX - this.selector.offset().left)/this.width))), |
202 _valeurs = this.groups[_segment], |
207 _valeurs = this.groups[_segment], |
203 _width = this.width / this.sliceCount, |
208 _width = this.width / this.sliceCount, |
204 _html = '<ul style="list-style: none; margin: 0; padding: 0;">' + IriSP._(this.tagconf).map(function(_tag, _i) { |
209 _html = '<ul style="list-style: none; margin: 0; padding: 0;">' + IriSP._(this.tagconf).map(function(_tag, _i) { |
205 return '<li style="clear: both;"><span style="float: left; width: 10px; height: 10px; margin: 2px; background: ' |
210 return '<li style="clear: both;"><span style="float: left; width: 10px; height: 10px; margin: 2px; background: ' |
206 + _tag.color |
211 + _tag.color |